Skip Navigation

[Résolu] CRED generic field first "Please select" option

This support ticket is created Il y a 8 années et 5 mois. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

Marqué : 

This topic contains 2 réponses, has 2 voix.

Last updated by carletto0282 Il y a 8 années et 5 mois.

Assigned support staff: Luo Yang.

Auteur
Publications
#229705

Hi guys,

I've created a form with several CRED generic field, select type, and I like to have a default message on the select element when the form loads. Something like "Please, make your selection"

I've tried to

1. set the first option value to "0". Doing so the option doesn't appear at all
2. set the first option value to "-1". It is registered in the database as an ordinary option
3. set the "default" value of the generic field with the message I already pointed out above. It doesn't appear while displaying the form

Is there a way to do this?
Thank you

Best regards
Carlo

#229771

Luo Yang
Supporter

Languages: Anglais (English ) Chinois simplifié (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Hi Carlo,

I suggest you set the first option value to empty, and set required = 1, like this:

[cred_generic_field field="test-select" type="select" class="" urlparam=""]
{
"required":1,
"validate_format":0,
"persist":0,
"default":[""],
"options":[
{"value":"","label":"default"},
{"value":"a","label":"a"},
{"value":"b","label":"b"}
]
}
[/cred_generic_field]
#229773

Great Luo!
Thank you!