Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    It’s normal because “—” isn’t an empty value. There is no need to trigger an error.

    If you want to add an empty value option at the top of a drop-down menu, use include_blank option.

    See Select and Select*

    eddiebouncer

    (@eddiebouncer)

    Same issue here,

    using ‘include_blank’ results in “—” which fools the validation.

    Here’s a post on how to change the “—” into something else, but this still doesn’t leave the field empty

    Any suggestions would be appreciated.

    simple use
    first_as_label

    following example help you to understand

    <div class=”col-md-4 col-xs-12″>[select menu-679 first_as_label “Monthly Budget” “$4000” “$5000” “$6000” “$7000” “$8000” “$9000” “$10000” “$11000” “$12000” “$13000” “$14000” “$15000”]</div>

    Hey, thanks for the comment.

    Unfortunately that doesn’t work. I’ve tried both include_blank and first_as_label. This thread is here

    I mainly posted here to add how to change the “—” into smt else.

    Cheers

    hey #eddiebouncer

    please check select.php under contact-form-7/modules/

    line number 71 , you gonna understand how it’s works

    You mean:

    if ( $include_blank || empty( $values ) ) {
    		array_unshift( $labels, '---' );
    		array_unshift( $values, '' );
    		$shifted = true;
    	} elseif ( $first_as_label ) {
    		$values[0] = '';
    	}

    I can change ‘—‘ to ” which makes it blank onscreen alright. But the initial empty select-field passes validation, even when a visitor would forget to select an option.

    Weird? Cheers

    from above code you need to understand elseif part

    elseif ( $first_as_label ) {
    $values[0] = ”;
    }

    when you use first as label the first value you ara mention is taken as label for select box and having value null or zero

    for required you just need to add * before select

    <div class=”col-md-4 col-xs-12″>[select* selectBudget first_as_label “Monthly Budget” “$4000” “$5000” “$6000” “$7000” “$8000” “$9000” “$10000” “$11000” “$12000” “$13000” “$14000” “$15000”]</div>

    I understand, but it doesn’t work.

    I’ve tried first_as_label (with select* from start) and include_blank also. It just passes validation. I dunno what else i can try..

    Add.: I only have this issue with the select* field. Other empty text-fields are validated correctly.

    Pff, i’ve found how to make it work…

    I had [select* your-day include_blank “1” “2” “3” “4” “5”] Now i changed ‘your-day’ into ‘yourday’. So the dash was the culprit…

    Thanks for thinking along! Peace.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Select required and include_blank’ is closed to new replies.