cancel
Showing results for 
Search instead for 
Did you mean: 
Workflow Hero

2 Submit buttons in a form,

Hi all,

I have 3 buttons in a form, one save button and other 2 are save and submit buttons. save will be saving the data to list without any validations.

i am facing issue while submitting the data. My scenarios are as explained below.

1. When they click on submitggg button only ggg Text filed filed should be mandatory.

2. When they click on submitnnn button only nnn Text filed filed should be mandatory.

So i have written 2 rules validating both.

For submitggg button--  isNullOrEmpty(Ggg)

For submitnnn button --  isNullOrEmpty(nnn)

But now whichever the submit button i click both the validations are triggering. How to avoid this situation?

Regards,

Hema

Labels: (2)
0 Kudos
Reply
4 Replies
Workflow Hero

Re: 2 Submit buttons in a form,

Hi!

Submit will always cause all validation rules to validate. If you have scenarios like this you will have to create more complex vaidation rules or use java script to determine which button was clicked and run a custom validation method.

One solution without javascript could be to have a control that determines the scenario and just have one save and submit button. The control coult be a check box or a dropdown for excample.

Let's say it's a checkbox with the name "isNNN" then the validation could be like

and(isnnn, isNullOrEmpty(nnn)) or and(not(isnnn), isNullOrEmpty(nnn))

If it's a dropdown with the name scenario it could look like

and(contains(scenario, "nnn"), isNullOrEmpty(nnn))

Does this make sense? Would it be helpful for you?

Best regards

Enrico

Accept as Solution Reply
Workflow Hero

Re: 2 Submit buttons in a form,

Thank you for the suggestion. i will go with the Javascript since i have more than 1 submit button in my form.

0 Kudos
Accept as Solution Reply
Workflow Hero

Re: 2 Submit buttons in a form,

Hema manjunath‌ - 

What about hiding the buttons until the control is Not(isNullOrEmpty())

This way they cannot Save and Submit until one of them is filled in. The only issue that this would cause is what happens if they enter data into both controls?

Perhaps once they add something to one control it shows the Save&Submit button as well as hides the other control?

Hope this helps!

Accept as Solution Reply
Workflow Hero

Re: 2 Submit buttons in a form,

This is what i've done in this situation. I disabled the button (instead of hide) when the condition was not met. So disable the submitggg button when ggg is null or empty. Then have no validation rules.

Accept as Solution Reply