On my page, I would not use PHP to send emails (please, do not comment) then came to a solution with external service which is invoked by fetch. That is why I submit my form data with onclick
function; and this onclick
is bound to button. Practically this onclick
doesn't use form features, it simply grabs form's data by its ID.
That button stays outside of the form. Needless to say that in that case, I do not benefit from typical form features like required and pattern validate.
Is there a simple way to have a button which sends data by onclick
and also triggers form validation? By form validation, I mean usual internal HTML
validation. Of course I could develop validation within onclick
function body, but that is not what I am looking for - I'd like to use form's features instead.