This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



May 2, 2011, 9:39 AM
33 Posts

onComplete executes even if the validation fails

  • Category: Dojo and Client Side JavaScript
  • Platform: All
  • Release: 8.5.2
  • Role: Developer
  • Tags:
  • Replies: 4
You can execute client side script when the server side JS execution is finished by placing your code to onComplete event. I have a submit button and I would like to have a client side JS to be executed ONLY if the form validation is passed and data is submitted. But by default onComplete event is fired even if the validation fails.
Any idea how to achieve such behaviour?
May 3, 2011, 2:30 AM
25 Posts
Re: onComplete executes even if the validation fails
 If you select the custom control/xpage in the outline, then navigate to the events tab, expand "data" you should see your data source listed there. If it's a document, you should have a postSaveDocument event there that shouldn't fire until after the save has completed.
May 3, 2011, 5:37 AM
33 Posts
Re: onComplete executes even if the validation fails
Hi Keith,
 
Thanks for the fast response. Unfortunately it is not an option as I am using a bean and not Domino document data source and thus there is not postSaveDocument event available and also I need the JS client side to be executed.
Anyway, it seems that I oversimplified the description, so there is one more try:
I would like to assemble simple prototype workflow application. I would like to have Submit for Approval button that saves the document (if all validations are passed) and if save is completed then shows the modal dialog window where the user can specify who will be the approver and put a comment. If closed with OK the document is moved to another status and a mail alert is being sent.
The problem that I am currently facing is the fact that onComplete event connected to Submit for Approval button is fired even if the document is not saved due to not passed validation.

May 3, 2011, 7:48 PM
122 Posts
Re: onComplete executes even if the validation fails
The method I used to workaround this was to put a value into a Hidden Input control if validation succeeded, then check on dojo.byId("hiddenInput1").value as to whether the onComplete should trigger or not. Not ideal, but functional.
May 4, 2011, 7:49 AM
33 Posts
Re: onComplete executes even if the validation fails
Thanks Paul for the tip.

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal