Expand my Community achievements bar.

Getting Submit URL ?

Avatar

Level 2

Hi,

I have a form with 2 submit buttons, each one submit to a specific URL. I d like to add some custom validation to only one of them. When I add this custom javascript code to one of them within the pre-submit event, it's applied to other submit button.

Is there a way to differentiate the submit button clicked like based on submit URL ?

I'm really blocked, Will appreciate your help!!

David,

4 Replies

Avatar

Level 6

As this custom script need for only one button, can move that script to click event itself and can take care the things, if this code block not thru can cancel the rest of the steps.

If need to place on pre-submit it self:

1. Place a new field on form as hidden field, ex: flagField.

2. Assign some specific text/number for "flagField" on click of the Submit button which is required to execute custom code, If click on another submit clear "flagField"  value or assign different text/number.

2. Now on pre submit, do compare with "flagField" value and execute custom code script for required button.

Avatar

Level 2

Hi Raghu,

Thanks for your quick reply.

The big issue  is that buttons of type Submit do NOT have click event. Otherwise, I know how to deal with.

But, since there is no click event and pre-submit event is applied to all buttons of type submit, I don know how to control this specefic button.

Thanks in advance for any ideas!

David.

Avatar

Level 6

Please check the sample pdf provided in with the link: https://acrobat.com/?d=VChGiMs8Cs8EKx3lCgkhTA

In this added 2 more button as "Regular" type ones (current you may have "Submit" type ones). "Submit" buttons made as "Invisible" and on click of "Regular" button assign some "flag" and compare that flag on "preSubmit" event. can add custom script on click of "Regular" button before calling the actual "Submit". If you tried already this approach please ignore this.

-Raghu.

Avatar

Level 2

Thank you soo much  Raghu !! You really saved my life. I was blocked there since 1 day.

I owe you a Beer man

Thanks again.