Thanks a lot Farrukh. Javascript is working with AjaxSubmit Buttons now.
We are using Wonder and will try to use WOGNL framework as per your suggestion. Thanks & Regards, Kalpana. On Sun, May 30, 2010 at 11:14 AM, Farrukh Ijaz < farrukh.i...@fuegodigitalmedia.com> wrote: > Do the following and it will work: > > Add a method as follows in your script: > > function ajaxCheckValidations(o) { > checkValidations(); > return o.form.onsubmit(); > } > > And change the AjaxSubmitButton binding as follows: > > AjaxSubmitButton1: AjaxSubmitButton { > value = "Save"; > class = "ok"; > onClickBefore = "ajaxCheckValidations(this)"; > action = ajaxButtonAction; > evalScripts = true; > } > > The reason why it was not working is: > > Since WOActiveImage is not an ajax component, it causes the form's > onsubmit() event to fire. The validations get fired on form's onsubmit(). In > case of AjaxSubmitButton the onsubmit() won't get fired. So you need to > trigger it manually as I did in the javascript function. Also you need to > use onClickBefore instead of onClick. if the value of onClickBefore is > evaluated to true, the action will be called. > > I hope this will solve the problem. > > I would suggest, if you're using Wonder then try using WOGNL framework and > instead of maintaining separate binding files, use <wo: tags. This will make > the code easy to read and maintain. > > Like e.g. in your html file, instead of using <WEBOBJECT NAME= > AjaxSubmitButton1></WEBOBJECT> you can use something as follows: > > <wo:AjaxSubmitButton value="Save" class="ok" onClickBefore= > "ajaxCheckValidations(this)" action="$ajaxButtonAction" evalScripts= > "$true"/> > > Farrukh > > On 2010-05-29, at 8:20 PM, Kalpana Vaka wrote: > > Hi All, > > Please find the enclosed compressed file with the sample application that > depicts the Java script problems with AjaxSubmitButton. > > The application has the following components. > > 1) One *Text field* > 2) One *WOActiveImage* Button > 3) Two *AjaxSubmit**Buttons ("Save" & "SecondSave")* > 4) Javascript file that is being used for calling script validations from > WOComponent (gen_validatorv2.js). > > When we click on *WOActiveImage *without entering anything in the text box > then, Javascript validation is being executed *onClick*ing the button and > form is not getting submitted until we enter valid value in it. It is > working fine. > > And for *AjaxSubmitButton1* also, same javascript function has been given > for onClick event binding. But, the validation is not getting fired and we > are not seing alert window. > > For both of the above Submit buttons, javascript validations from > gen_validatorv2 file are being called. > > And for *AjaxSubmitButton2*, different javascript function is binded to > onClick event. This javascript function is not calling any of the methods in > gen_validatorv2.js. In this case, we are getting the alert with the > validation message. But, form is getting submitted on clicking on the OK > button in the alert box. > > So, finally the issues with AjaxSubmitButtons are summarized below. > > 1) When we use external javascript file (gen_validatorv2.js), we are not > getting alert window with the validation failure message and action method > is being called. > > 2) When we write javascript function in the WOComponent itself, we are > getting alert with the validation failure message. But, the action method is > being called in case of validation failure too. > > Any help in resolving this issue? > > Thanks & Regards, > Kalpana. > > > > <TestApp.rar> _______________________________________________ > Do not post admin requests to the list. They will be ignored. > Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) > Help/Unsubscribe/Update your Subscription: > > http://lists.apple.com/mailman/options/webobjects-dev/farrukh.ijaz%40fuegodigitalmedia.com > > This email sent to farrukh.i...@fuegodigitalmedia.com > > >
_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com