We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum

Forum

Thread tagged as: Question, Problem

Form Submission Input Value

Hey!

When a form is submitted, is there a way to stop it changing the inputs value automatically? So when i send a form submission, it pre-fills the input with what was sent, but I want it to refresh to default again, rather than pre-filling the input with what was sent before page load.

It's for a hidden input, I've got an ID I want to pass with multiple forms on a page, but it's changing the ID for all the other forms after first submission.

Ryan Gittings

Ryan Gittings 1 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

What sort of form? Public form or control panel form?

Ryan Gittings

Ryan Gittings 1 points
Registered Developer

It's a custom form, for an app.

Someone also mentioned that http://forum.grabaperch.com/forum/03-02-2017-unable-to-submit-2-forms-in-same-template-file may be related.

Drew McLellan

Drew McLellan 2638 points
Perch Support

I'm still unclear.

Are you displaying this form in the control panel, or are you displaying the form on a public web page?

Ryan Gittings

Ryan Gittings 1 points
Registered Developer

Public page, using Perch:form

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok. Yes, you can set env-autofill="false" on the field.

Ryan Gittings

Ryan Gittings 1 points
Registered Developer

I've got it like so:

<perch:form id="set_list_active" method="post" app="humdinger_list"> <perch:input type="hidden" id="listID" value="<perch:list id="listID" env-autofill="false" />" /> <button class="button tiny" type="submit">Submit</button> <perch:input type="cms" /> <perch:input type="hidden" id="token" />

But it still appears to change the value?

Drew McLellan

Drew McLellan 2638 points
Perch Support

It needs to go on the input.

Ryan Gittings

Ryan Gittings 1 points
Registered Developer

Ah cool, thanks Drew.

I used the perch shop variant template as an example:

<perch:input id="product" type="hidden" value="<perch:shop id="productID" env-autofill="false" />" />