im searching for a way to put a watermark on select fields.
that is not working ->
[select* c_type class:ic watermark "choose type" "a" "b" "c"]
to put a not valid value that fail validation, i had to put include_blank
[select* c_type class:ic include_blank "a" "b" "c"]
but the problem is that i have ---
as watermark, thats what i want to change..
More recent versions of Contact Form 7 allow the use of first_as_label to create placeholder text that does not validate as an entry if users do not make a selection. Simply make your placeholder text be the first label in the list of options.
[select* food-choice first_as_label "Preferred food?" "Cake" "Pizza" "Burger" "Salad" "Donut"]
Try this:
[select* menu-206 first_as_label "Select doctor" "David Mikaberidze" "Sophio Gelashvili" "Maya Dolidze"]
If you find string replacement unefficient, you could simply use this:
jQuery(function($) {
$("select option:first").attr('disabled', 'disabled');// Disable the first value/label ---
});
I also made sure that the first alternative is the "label" i want to use, by adding 'first_as_label' to the shortcode in wcf7, like this:
[select name first_as_label 'label' 'alt1' 'alt2' 'alt3']
By making the first option disabled, wcf7 won't confirm the form until this an enabled alternative is chosen.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With