Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Can you add javascript code to a submit button? Driving me nuts!


Level 1

In my form, I have added a button to submit the form via email.  I have also added javascript code to the button so that when clicked, it will add a date to a text field and then lock the fields and make the submit button invisible.  When I break down the process, i.e. I set up the button as a submit via email.  That works.  I then add the javascript code to add a date to a text field, that works together with submitting via email.  When I add the javascript code to lock the fields and make the submit button (AcceptTerms) invisible, everything works, except sending the form back via email!  It's driving me nuts because I have used this formula many, many times and it has worked perfectly.  Why not now?  I am using ES2 and here is the code:

EffectiveDate.rawValue = util.printd("mm/dd/yyyy",new Date());


      // The following code confirms whether to Lock the form

      var cMsg = "Please ensure that you have checked the box above accepting the terms of sale.\n\n"

      cMsg += "By selecting OK the form will be set up to send via email.\n\n"

      cMsg += "Select CANCEL to stop submission of the email.\n\n"

      var nRtn = app.alert(cMsg,1,1, "Lock Form");

      if(nRtn == 1)

      { // A Yes Answer//Protects each field

     CheckBox1.access = "protected";

     EffectiveDate.access = "protected";

     AcceptTerms.access = "protected";

     AcceptTerms.presence = "invisible";





0 Replies