CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

JQEdit OnChange client side claculation

by Davide » 27 Nov 2013 17:25

Hello,

on my form I need to perform some claculation based on a TCGJQEdit value change.
Which "change" event I have to use to start my calc ?

Cause my calculation is based on some values I retrieved server side at the moment I'm working using Ajax (OnAsyncChange).
Is there a way to save some JSON object to the client to use on calculation without the Ajax roudtrip ?

Where I have to write my client script?
Can I use JQuery ?

I know these are a lot of questions but they are related to each other.
Please suggest me where to find some samples cause I didn't find anything on the demo.

Thank you,
Davide
Davide
 
Posts: 150
Joined: 14 Oct 2013 11:33

by Jorge Sousa » 28 Nov 2013 19:37

Hi

on my form I need to perform some claculation based on a TCGJQEdit value change.
Which "change" event I have to use to start my calc ?


You've OnAsyncChange inherited from Intraweb.

and JQEvents.OnChange, from our own event prespective and capabilities.

To use client script, you can use JQEvents.OnChange.Script.

Cause my calculation is based on some values I retrieved server side at the moment I'm working using Ajax (OnAsyncChange).
Is there a way to save some JSON object to the client to use on calculation without the Ajax roudtrip ?


To send script to the client, you can use

You can use TIWAppForm.AddToInitProc(js) to render javascript on a full post / submit (calling in TIWAppForm.OnRender for instance)

and for ajax/async events, call
WebApplication.CallBackResponse.AddJavaScriptToExecute(js) or .AddJavaScriptToExecuteCDATA(js).

include javascript like

var myobj = {name:"myname"; value: 123};

To send data from client to browser, besides the data already sent automatically, you can use BrowerParams of any cg event class, like in JQEvents.OnChange.BrowserParams

Can I use JQuery ?


Of course, you can use any valid scripting language, jQuery library is automatically included in every page. you can include other javascript libraries and other web script languages like java.
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58


Return to JQEdit

cron

Who is online

Users browsing this forum: No registered users and 1 guest

Contact Us.