Forum

Thread tagged as: Question, Forms

Forms HTML5 input attributes

I have a site in development with several forms that can appear in various combinations on multiple pages (some in modal dialogues so require Ajax handling). Perch Forms changes the ID of forms with a prefix (eg form1_) added to the form ID. This means that a particular form can appear on one page as #form1_newsletter and on another as #form2_newsletter.

I have tried using the HTML5 input attribute form="ID reference" on the submit button so that it is easy to target the form being submitted but it just gets stripped.

Am I missing something or is this expected behavior?

Ultimately I can write some javascript to traverse the DOM but this would be a much more elegant solution.

Kevin Jackson

Kevin Jackson 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

You can specify your own prefix for the IDs, so it will always be the same. You just need to manage the forms yourself to make sure each one has a unique prefix on the page.

https://docs.grabaperch.com/docs/form/template-tags/form/

Drew

Thanks, that will do the trick.

Kevin

Drew McLellan

Drew McLellan 2638 points
Perch Support

The form attribute is a new one on me (a new one altogether, it seems) so we'll see if we can get passthrough added.

Thanks. when I can find time I'm going to write some javasript that will "just work" for Perch Forms in modal dialogues for Foundation, Bootstrap and plain jQuery without having to do much with the forms themselves.