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



Jul 10, 2012, 9:14 AM
3 Posts

Submit Button & Button event

  • Category: Dojo and Client Side JavaScript
  • Platform: Windows
  • Release: 8.5.3
  • Role: End user,Developer
  • Tags:
  • Replies: 2
Hi all,
I've a good experience with Domino apps but I'm moving my firts steps in XPages, so may be my question could be a little simple...
I'm developing a form where the user will fill some field . I added field validation and the usual Submit button at the bottom of the page, then I added and event (client side) to the submit event . This event trigger a LS agent on the server .
Everything works fine if the fields are filled correctly: the document is saved, the agent is activated and I'm happy
but... if the form is not validated (i.e. one or more field is wrong) the event is triggered anyway , the agent starts but I want to avoid this.
In other words: how can I avoid to trigger the event is the form is not validated ?? (This is something similar to the $$Return field in a form , I'd like to reproduce it in an Xpage)
 
This is the event (quite simple):
var noteid = document.getElementById("#{id:tempid}").value;
var addr = "/db.nsf/prev?openagent&" + noteid ;
window.open(addr) 
 
Thanks in advance
Fabio
Jul 12, 2012, 2:14 PM
43 Posts
Re: Submit Button & Button event
I don't know whether I understood your problem properly.
However, when we have a form and a submit button ...then to stop submitting use the client side script of the same button. Put all your validation behind that button and return false in every loop when you don't want to submit. Returning false restrains submission in all cases.
Also, It would be better if you describe you problem with the entire code...still not clear.. 
Aug 2, 2012, 6:01 AM
26 Posts
Re: Submit Button & Button event
You need to stop the agent from Trigger if form is not validated, right ?
then try this: Add a validate function and check the result of the the function, if it returns false then don't trigger the agent.
  •  normally a SSJS function returns True or False.
 Tried this once and it works fine.
 
 
Regards,
Pranesh Vaidya

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