Select Option Display vs Value as Rendered to HTML
-
I have a form that requires an address – thus a “State” select drop down.
I am sending this form via JSON to the client before the form validates and sends the email, etc.
The client requires the two letter state abbreviation (value) to be sent to their system, but wants to display the full state name.
So, what we want is
<option value="AL">Alabama</option>
Which is what you would expect to be rendered to the html when you use the following in CF7
[select* State "Alabama|AL"]
However, what renders to the browser is actually
<option value="Alabama">Alabama</option>
If I use [State] in the email output, it reports “AL,” but I’m pulling directly from the value on-page and need it to be what I’m telling it to be.
Because of this, I have been forced to pull out the CF7 rendered HTML, create my own custom shortcode, and edit the option values manually.
As you can imagine, this is inefficient (it’s a loan application with tons of fields). I’m open to other suggestions, but this was the only way to do it that I could figure out.
Now, I am trying to add some custom validation to various fields, and the fact that I had to pull out the HTML manually seems to be stopping WPCF7_Shortcode from working properly for custom validation. So now I’m stuck…
Please advise – I’d like the input values to be rendered to the page (solves my problem entirely) or a better way/workaround to accomplish this.
Thanks,
- The topic ‘Select Option Display vs Value as Rendered to HTML’ is closed to new replies.