Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Contact Form 7 watermark for select menu

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..

like image 385
Iliya Reyzis Avatar asked Nov 01 '12 13:11

Iliya Reyzis


3 Answers

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"]
like image 106
user5071251 Avatar answered Oct 22 '22 10:10

user5071251


Try this:

[select* menu-206 first_as_label "Select doctor" "David Mikaberidze" "Sophio Gelashvili" "Maya Dolidze"]
like image 33
Aarzoo Patel Avatar answered Oct 22 '22 08:10

Aarzoo Patel


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.

like image 31
Foley Avatar answered Oct 22 '22 08:10

Foley