Closed jonkersdw closed 2 years ago
Good catch! Could we call the ID af_email_for_non_humans
instead? Just to not interfere with other elements on the page (however unlikely).
So that it doesn't interfere with other elements I change the field and label to utilize the form key this will allow multiple forms to be added on the same page. As long as they are different created forms. Now if the same form might be used then the ID should be more dynamic when the form is rendered.
Maybe a timestamp?
I changed it to.
echo sprintf( '<label for="af_email_for_non_humans_%s" aria-hidden="true">Email for non-humans</label>', $form['key'] ); echo sprintf( '<input type="text" name="email_for_non_humans" id="af_email_for_non_humans_%s" tabindex="-1" autocomplete="off" />', $form['key'] );
I think this is good for now! The plugin also uses what I call an "instance hash" to separate the same form used multiple times on a single page. Might switch to that in the future if necessary but this should be fine :)
Thanks a lot!
The id attribute is required on the input field when adding a label