Forum

Thread tagged as: Question, Forms

Can't submit form with disabled input

I have a form with a disabled text input that is given a value based the variable that is passed to the page. As soon as I add the disabled="disabled" the form no longer submits. This is the input:

<perch:input type="text" id="villa" required="true" label="Villa" value="<perch:content id="current_villa" />" disabled="disabled" />

I assume this isn't an error, but intended. I didn't want this value to be edited via the form, anything I can do?

Brad Hardinge

Brad Hardinge 0 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

If an input is disabled, its value is not sent by the browser to the server. You've set the field to be required, so the server will be throwing a validation error.

Could you not just make it hidden?

Ah, I see. A hidden field and simply displaying the variable will work. Thanks.