Skip Navigation

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

This support ticket is created hace 6 años, 3 meses. 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.

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

Este tema contiene 1 respuesta, tiene 1 mensaje.

Última actualización por Tim Elliott hace 6 años, 3 meses.

Autor
Mensajes
#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.