1

According to Freeform Pro's documentation, the default_value parameter should let you designate a default (non-first) selection for any field without relying on JavaScript...

Also available is the default_value="VALUE" parameter, which can be applied directly to the {freeform:field:FIELD_NAME} variable. For field types that contain predetermined values such as select lists and radios, this can be used to pre-select a value from that list. For field types such as text input or text area, this can be used to add sample text to the field.

With Freeform Pro 4.1.7 on EE 2.7.2, this line (a State select field) fails to set any default even though Washington is in the list.

 {freeform:field:state attr:id="state" attr:class="required" default_value="Washington"}

So the resulting default value, as usual, is Alabama.

Solspace has advised using JavaScript in response to other questions, but I'd rather utilize this parameter since it appears to exist for exactly the case I'm interested in.

Am I missing the point or doing something wrong? Maybe misRTFM?

1

It's working, you just have to use the default value, not the default label.

The clue:
<option value="WA">Washington</option>

The answer:
default_value="Washington"
default_value="WA"

For the win...

 {freeform:field:state attr:id="state" attr:class="required" default_value="WA"}
| improve this answer | |
  • High five, self! Another one asked and answered, undetected by others. – Matt Stein May 9 '14 at 0:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.