• Resolved pedrorinconb

    (@pedrorinconb)


    I want to change the placeholder of a datepicker dropdown (Change the “select month”), but I only have the option to change the labels

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @pedrorinconb

    I hope you are doing well

    You can edit the PO/MO to add your custom translation, Loco translation plugin can help.

    Another alternative is using the below code:

    <?php
    
    add_filter('forminator_field_date_markup', function( $html ){
    
    	$html = str_replace( 'Select month', 'Custom text', $html );
    
    	return $html;
    
    }, 10, 1);

    Add it as a mu-plugin following this guide https://wpmudev.com/docs/using-wordpress/installing-wordpress-plugins/#installing-mu-plugins

    Best Regards
    Patrick Freitas

    Thread Starter pedrorinconb

    (@pedrorinconb)

    I used the code and it worked perfectly, thank you so much!

    Hi, thanks for this, what about for select year code

    Plugin Support Nebu John – WPMU DEV Support

    (@wpmudevsupport14)

    Hi @mariamshabs,

    The following code can help replace “Select Year” with custom text in the date picker dropdown.

    <?php
    
    add_filter('forminator_field_date_markup', function( $html ){
    
    	$html = str_replace( 'Select Year', 'Custom text', $html );
    
    	return $html;
    
    }, 10, 1);

    I hope that helps. Please feel free to contact us if you need further assistance.

    Kind Regards,
    Nebu John

    Thanks, awesome, works perfectly, but I want to also add none as part of a selection for the Month, Date and Year

    Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @mariamshabs

    but I want to also add none as part of a selection for the Month, Date and Year

    This wouldn’t be that simple, I’m afraid. It would be possible to “inject” such “none” option to choose from but then it’s a matter of validation and how the data is stored in the database which makes it a bit too complex at this point.

    I would suggest instead using an additional field. It could be e.g. radio or select field with two options, like

    – “I want to select date”
    – “No specific date”

    then if the first one is selected, the datepicker shows up (based on visibility condition) and if the second one is selected, the datepicker just doesn’t show up.

    Kind regards,
    Adam

    Thanks, done as suggested and it works perfectly as well

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Change Placeholder of a Datepicker dropwdown’ is closed to new replies.