Ran into a scenario where a form could have actions such as "Cancel form" or "Save form" which may want to bypass validation in which case the user should not be presented with a recaptcha.
There's also a secondary issue which this change allows a developer to bypass where there are multiple actions with type="submit". e.g. if there was a Submit and Cancel action on the form and the user clicks the cancel action, normally a form would pass action_cancel in the FormData posted to the server. But because the NoCaptcha js calls preventDefault on the SubmitEvent and calls form.submit() via Javascript after recaptcha has passed, the SubmitEvent loses context of the action which was clicked. This leads Silverstripe just process the request using the default action. More info here.
<input> with attribute type="submit" will not be submitted with the form when using HTMLFormElement.submit(), but it would be submitted when you do it with original HTML form submit.
Ran into a scenario where a form could have actions such as "Cancel form" or "Save form" which may want to bypass validation in which case the user should not be presented with a recaptcha.
There's also a secondary issue which this change allows a developer to bypass where there are multiple actions with
type="submit"
. e.g. if there was a Submit and Cancel action on the form and the user clicks the cancel action, normally a form would passaction_cancel
in the FormData posted to the server. But because the NoCaptcha js calls preventDefault on the SubmitEvent and calls form.submit() via Javascript after recaptcha has passed, the SubmitEvent loses context of the action which was clicked. This leads Silverstripe just process the request using the default action. More info here.