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?
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.
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?
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!
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.