Hi Champ,
I have a form where I have different milestone and submit button is there in the last milestone. So user can go to any of the milestone at any given point of time during initiation but when they press the submit button, we need to show the validation for all the mandatory fields that we have in the interface. So for validation we are calling a rule which is checking for all mandatory fields that we have in one of the constants and that give us the fileds which are missing and accordingly we are showing the message to user. Now that is working filne ;but getting a strange issue here. When user submitting with giving all details in all milestone and clicking submit button the page is not getting submitted . when we click for the second time it is getting submitted. What I suspect is that for the first time it is only checking the validation and for the second click as there is no validation issue, it is getting submitted. But What I expect is fir the first time itself it will check the validation and if nothing is there it will submit automatically .
I am pasting my code snippet for submit button as below:
submit: if( toboolean( local!validationResult.isApAllDetailsCompleted ) = true(), true(), false() ),
Note : local!validationResult is the variable which determines if there is any validation error is there or not and this is populated in save into parameter of Button.
Discussion posts and replies are publicly visible
I think that this is the expected behavior. That button is displayed, and when clicked, it evaluates your logic. But at the time of evaluation submit is false.
I remember other developers trying the same trick, without success. Why not just disable that button in case there are any issues?
That is because you are evaluating your rule only on the next or submit, this would return you a negative value when you try to do both submit and evaluation at the same time. You would have to have it run in some other place(a new button to verify the details) or disable the button till all the details are available.