Skip Navigation

[Resolved] Problems adding a blank "Please Select" option to a taxonomy dropdown in a form

This support ticket is created 7 years, 11 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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 3 replies, has 2 voices.

Last updated by Luo Yang 7 years, 11 months ago.

Assisted by: Luo Yang.

Author
Posts
#394622

I am trying to append a "Please select" option as a first option in a taxonomy select field in a CRED create form with the help of this post:
https://toolset.com/forums/topic/cred-blank-default-value-for-taxonomy-select-field-validation/

But the string

jQuery("select[name='wpcf-rating']").prepend('<option value="">- Select -</option>');
jQuery("select[name='wpcf-rating']")[0].selectedIndex = 0;

gets replaced to

jQuery("select[name='wpcf-rating']").prepend('- Select -');
jQuery("select[name='wpcf-rating']")[0].selectedIndex = 0;

after I save the CRED form. This issue is also outlined here:
https://toolset.com/forums/topic/create-dropdown-from-taxonomy-with-the-option-of-having-blank-value/

As a result the code does not work. What is the problem?

#394962

Dear George,

Please try the solution in another similar thread:
https://toolset.com/forums/topic/javascript-modified-when-saving-cred-form-2/

#394980

That should work, but unfortunately it hasn't, tag still getting stripped after save!

#395213

I just test the codes in my localhost, it works fine, please check these:
1) you are using the latest version of CRED form
2) add the custom PHP codes into your theme/functions.php as the post:
https://toolset.com/forums/topic/javascript-modified-when-saving-cred-form-2/#post-364903
and test again
3) If the problem still exists, please deactivate other plugins and switch to wordpress default theme, and test again.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.