2

I am using FreeForm Pro (4.2.0) with EE2 (2.9.0).

We are using the "Composer" method of creating forms to generate the select input Country and State field types.

I am seeing "Afghanistan" and "Alabama" being selected by default (by virtue of them being listed first in the alphabet).

Is there a way to add a blank leading option something like:

 <option value="" selected>Please select...</option>

Having the first value in the list selected is not working well versus form validation.

1

Sorry, that is currently not available. I recommend submitting this as a Feature Request under the specific add-on category. It'll also give other users the option to vote up the feature request, and help us prioritize features to add in upcoming versions of this add-on. :) http://support.solspace.com/support/discussions

In the meantime, if you feel adventurous, you can add an empty "Please select..." option by going into /system/expressionengine/third_party/freeform/default_fields/freeform_ft.country_select.php, and finding the display_field() method (near line 94). In that general area you will find this line:

$countries = $this->get_countries();

Change that line to this:

$country_select_one[''] = 'Please select...';
$countries = $this->get_countries();
$countries = array_merge($country_select_one, $countries);

This will add an option with an empty value at the beginning of the country dropdown list.

| improve this answer | |
  • Thanks! Looks like there is an existing request for this feature: support.solspace.com/support/discussions/topics/30384 – AllInOne Sep 17 '14 at 15:52
  • Great! If you haven't already, you can add your +1 on that FR. Or else we won't know how many people want a certain feature. Thanks! – Solspace Sep 18 '14 at 2:44
  • What would be the solution here for states?Thx! – Danielle LeComte Apr 17 '15 at 21:06
  • 1
    In freeform_ft.state_select.php, near line 47, find $states = array_map( and change it to $states = array('' => 'Please select...') + array_map( – Solspace Apr 21 '15 at 5:17

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.