• Hello,

    I would like to have a custom text as a first item and it would be the placeholder. This way the field would not have a selected option by default and it would have a placeholder.

    On a standard CF7 dropdown/select field we can achieve this with a “first_as_label” parameter. How could I do this with your plugin?

    Thank you.

    • This topic was modified 6 years, 11 months ago by Justinas.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author John Huebner

    (@hube2)

    This is shown in my example filter

    
    $choices = array(
            '-- Make a Selection --' => '',
            'Choice 1' => 'Choice 1',
            'Choice 2' => 'Choice 2',
            'Choice 3' => 'Choice 3',
            'Choice 4' => 'Choice 4',
            'Choice 5' => 'Choice 5'
        );
    

    the first items has not value and is the placeholder

    Thread Starter Justinas

    (@justinasdmt)

    Yes, but this first item is selected by default and the user can submit the form without selecting an option from this field. I want this field to be required so that the user is required to select one of the options.

    Plugin Author John Huebner

    (@hube2)

    then create it as a required field

    
    [dynamicselect* my-field-name]
    
    Thread Starter Justinas

    (@justinasdmt)

    Yes, that is the way I do it. But like I said the first option (‘– Make a Selection –‘) is selected by default and the user can submit the form without selecting any option from this field.

    The ‘first_as_label’ parameter in the default dropdown/select field makes the first option as a placeholder but not selected by default. I hope you understand what I mean.

    Plugin Author John Huebner

    (@hube2)

    If the value for this option is set up correctly and the field is required and submitted without a value then there will be an error telling the person that the field is required. I’m not sure what else you’re looking for here.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘First item / placeholder?’ is closed to new replies.