Support

Account

Home Forums ACF PRO Change null value in select

Solved

Change null value in select

  • Is there a way to change the null value in a select field to something else ?

    I found this topic but that didn’t get solved unfortunately, but that is what I’m looking for.

    This is my select.
    The first needs to show From, the second Till.

    I think it can be done with some jquery, but I’m not good at it.

  • Why not making some “From” and “Till” values (as default) for the selects and setting the fields as required?

    If you need jQuery, you should use the simple selects, not the data selects. Otherwise, you can try something like this:

    (function($) {
     $('select.field-class').find('option').first().text('From');
     $('select.field-class').find('option').first().text('Till');
    })(jQuery)

    Useful link:
    Adding custom javascript to fields

  • I had considered that (setting From/Till) as default… but there was something (which I can’t remember now) why I decided not to…

    The jQuery syntax is what I was looking for. Will test…

  • If someone comes across this:

    I have solved it in a completely different way.
    I just override/translate the placeholder with PHP.
    Works like a charm.

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

The topic ‘Change null value in select’ is closed to new replies.