• Resolved huangcq

    (@huangcq)


    Two issues I’ve been having with the select field:

    1. If I set it to “required”, I get a “please select an option” text by default. That’s fine, but I can’t change the text at all, at least I don’t see any way to do this.
    2. If I set it to “optional”, it seems to select the first option by default, and I can’t deselect it at all. Surely that isn’t right. Or am I missing something?
    • This topic was modified 7 months ago by huangcq.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter huangcq

    (@huangcq)

    Also, if it’s “required”, I can’t leave the placeholder field blank, and I can’t create a blank option. It seems that there is no way to blank out the field at all, be it required or optional. That’s very counter-intuitive.

    • This reply was modified 7 months ago by huangcq.
    Plugin Support Kris – WPMU DEV Support

    (@wpmudevsupport13)

    Hi @huangcq

    I hope you are doing well today.

    This is expected behavior. If you set up a select field as required without a placeholder then you need to set up one of the options as selected by default. If you set up a select field as required with a placeholder then there is no need to set up one of the options as selected by default as placeholder will show a temporary message that will trigger an error until you select an option.

    If select is set up as optional, then you can deselect 1st option and use placeholder for that matter.

    When it comes to “please select an option” I cannot replicate this on my lab site and we do not have such default text. Can you export your form, upload it to Google Drive and share a link in your next reply so that we can take a closer look at this?

    Kind Regards,
    Kris

    Thread Starter huangcq

    (@huangcq)

    Okay I neglected to mention that for both required and optional selects I was entering a space character for the placeholder. That’s how I got the first option pre-selected for optional select, and a “Please select an option” text for required select. Basically I just want a blank placeholder.

    I’ve since worked out I can get the desired result (of a blank placeholder) by entering “ ” instead of a space character. Not ideal but that’ll do for now ??

    Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @huangcq

    Yes, the “nbsp” being a non-breaking space (a “hard-space”) is a workaround because it doesn’t get trimmed by the JS/PHP code in this case upon validation/submission – it’s treated as any other regular visible character (except it’s not visible actually) while regular space would be considered same as “null”/empty and would trigger errors.

    I’m afraid there’s no better workaround for this currently so I’m glad you managed to work it out.

    I’ll mark this topic as resolved for now then but in case you’d still need some help with it, just let us know and we can get back to it at any time.

    Kind regards,
    Adam

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Issues with the select field’ is closed to new replies.