My form has a bunch of address fields (street, city, country, province, postal code) that need to be filled out over and over again. To make it easier for the user, I've added a "copy from" selector where they can choose an address they've previously used. When they do this, the form fields are filled in automatically and then disabled. This way they can clearly see what they're about to submit.
The problem is, if the fields are disabled, W3 says the inputs won't be submitted. That would be fine, because I can get all the data I need from the selector, except that now the form fails validation.
I figure I have two options:
- Re-enable the form fields just before submitting the form (but this is a bit of hack)
- Make all the address fields optional. But then I need to add a bunch of
clean_
methods to make sure they actually are filled in when you don't use the preset selector. Also, I'm using the address form all over the site, and in some places they truly are required, so I'd prefer not to make the fields optional. Although, I guess I could just copy-paste the address form and make a special case for this page.
Thoughts? What approach should I take?