• I’ve got a dropdown list (a not required field) that starts with “null_select”, so an empty field.
    Instead of not showing the record in the list on the front end (shortcode selects only fields that are not empty), the record is shown, and displays the text “null_select”.

    I’m quite sure the null_select function worked fine before, and have no idea where to look for a solution to get the list working again. I need the possibility to change this field to empty/no choice.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Roland Barker

    (@xnau)

    If you are not using “value titles” (that means using the :: notation to indicate a display value and a saved value for each option) for the options in your dropdown, you won’t need to include a “null_select” item. If you do include it, it will be treated as a literal option, as you describe.

    So: the solution is to either use “value titles” or remove “null_select” as an option in your dropdown.

    Thread Starter MarionFW

    (@marionfw)

    thanks for the reply.

    I do use value titles, but the problem also appear in other lists without value titles (I just tried this).

    The problem in both casis is: what if a value title has to be removed? I can’t delete a value once it has been added to a record, so I need a ‘no choice’option.
    How do I resolve this? Is there a way to add a ‘no choice’ field to the list?

    Plugin Author Roland Barker

    (@xnau)

    So, if you’ve got records with “null_select” as the stored value, you can fix this in the database if you know how to write simple database queries. If you want to work around it, you could create an option (using a value title) that was something like

    No Choice::null_select

    but that would continue the problem, not solve it.

    If the value in the record doesn’t match any of the defined options (and the field is not an “other” type field) then it will show the null option. If your options don’t use value titles, then you can just remove “null_select” from the options and let the problem fix itself over time.

    Thread Starter MarionFW

    (@marionfw)

    Hi,

    I’m afraid I’m not able to write database queries, so that’s no option, besides the fact that it does not really solve the problem. For a temporary solution, I could exclude this in the shortcode.

    But what really puzzles me is how removing “null_select” from the options in the dropdown list would solve my problem: it would leave all options, but not the possibility to empty the field: once a field has been chosen and stored, you cannot undo the choice either in the frontend or in the backend. That is why I used the null_select (as is explained in the part Values on https://xnau.com/work/wordpress-plugins/participants-database/participants-database-documentation/defining-participants-database-fields/ . “It’s a good idea to have either a null select or default defined for all dropdown fields.”).

    This null_select option did work fine before for all 3 dropdown listst I use (value not required, one with and two without value titles. Chosing the null_select option in the backend did result in an empty field just like when there never had been made a choice.

    Perhaps my question comes down to how to make the default an empty field.

    Thank you for bearing with me….

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘null_select not working properly’ is closed to new replies.