Page 1 of 2

Ajax events control

PostPosted: 16 Jun 2014 15:36
by assapan
Hi,
I have several controls ( mainly edit ) which are fires Ajax onchange events to detect modifications and enable a "Save" button.
My problem is when i want to fill the edit with data in a procedure called by an ajax event , the event onchange are fired after the procedure ends so i have my button save enabled :?
How can i overcome this ?


sorry if my question seems to be stupid for Ajax familiar people :mrgreen:

Re: Ajax events control

PostPosted: 16 Jun 2014 16:04
by Jorge Sousa
Hi

What event are you using?

Because with JQEvents.OnChange we cannot reproduce this. The OnChange should only be triggered when user changes the edit value, not programatically.

Re: Ajax events control

PostPosted: 16 Jun 2014 16:18
by assapan
I tried both JQevents.OnChange and OnAsyncChange , both are fired when i fill the value !? :roll:

Re: Ajax events control

PostPosted: 16 Jun 2014 16:26
by Jorge Sousa
Hi

I'm sorry but we cannot reproduce such behaviour, can you please submit a test case.

Of course that we're only setting IWCGJQEdit1.Text

Re: Ajax events control

PostPosted: 16 Jun 2014 16:59
by assapan
i will do so

Re: Ajax events control

PostPosted: 17 Jun 2014 09:48
by assapan
Hi,
please find attached the demo of my problem
if you click on a panel item , it fills the edit with panel item tag , my problem is that it fires the onchange event after that so how can i void this problem ?

secondly i have a problem with IWCGJQTDateTimePicker if i set the date format to be "mmm dd/mm/yyyy" it displays correctly the date like "mardi 17/06/2014 15:00" but when the date or time is changed the datetime property returns only 17/06/2014.

Re: Ajax events control

PostPosted: 17 Jun 2014 11:22
by Jorge Sousa
Hi

I've to apologise about the Edit OnChange, there was an error in our test, (we had .Ajax=False in the button that changed the edit).

We're going to fix this for next version.

About the date picker, we will back to you asap.

Re: Ajax events control

PostPosted: 17 Jun 2014 11:50
by assapan
Thank you very much

Re: Ajax events control

PostPosted: 17 Jun 2014 11:54
by Jorge Sousa
About the datepicker,

well, you follow your own rules, but we've to accept the consequences.

As it is in all of our demos, when you create a frame to perform .AjaxReRender / RenderRegionAsync, you must use CGCallbackDisableAjaxResponse and CGCallbackEnableAjaxResponse

like this:

procedure TIWForm4.ButtonClick(Sender: TObject; AParams: TStringList);
begin
CGCallBackDisableAjaxResponse;
with CreeFrame(TFrame_Edit, WebApplication, 'FrameEdit') as TFrame_Edit do begin
CGCallBackEnableAjaxResponse;
IWFrameRegion.AjaxReRender(True,False);
end;
end;

Re: Ajax events control

PostPosted: 17 Jun 2014 17:31
by assapan
hi,
i have done it but it doesn't solve the problem , is it suppose to ?