Skip Navigation

[Resolved] Custom Field dropdown has extra blank entry that is selected by default

This support ticket is created 6 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 1 reply, has 1 voice.

Last updated by Tim Elliott 6 years, 3 months ago.

Author
Posts
#1092516
Country dropdown.jpg

I am trying to:
Create a custom field search dropdown using the following code:

[wpv-control-postmeta field="wpcf-referral-countries" type="select" url_param="wpv-wpcf-referral-countries" default_label="Select Country"]

Link to a page where the issue can be seen:
Site is in maintenace mode at the moment - I can give yo login details privately if necessary

I expected to see:
A dropdown with the available countries. The top item should be "Select Country" and this should be selected by default.

Instead, I got:
A dropdown with the available countries. The top item is "Select Country" as expected, but below it there is a blank entry which is selected by default.
I've checked through and all of the posts have content in the country field so the blank item isn't coming from a missing entry.

The image shows the output and the code below shows the generated code.

<select id="wpv_control_select_wpcf-referral-countries" name="wpv-wpcf-referral-countries" class="js-wpv-filter-trigger form-control">
<option checked="checked" value="">Select Country</option>
<option value="" selected="selected"></option>
<option value="IT">Italy</option>
<option value="JP">Japan</option>
<option value="KE">Kenya</option>
<option value="KR">Korea, Republic Of</option>
<option value="ZA">South Africa</option>
<option value="ES">Spain</option>
<option value="GB">United Kingdom</option
<option value="US">United States</option>
</select>

It looks like we have:
checked="checked" on the default label
selected-"selected" on the blank entry

I've just run a test of this on a couple of different sites and it seems to work as expected.

Thanks
Tim

#1092521

Guys, forget this. Someone else had set up the fields and left a blank one at the top of each field set for some reason. What a waste of my life.