Skip Navigation

[Résolu] CRED content form does not save state of select box

This support ticket is created Il y a 7 années et 2 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.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

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

Supporter timezone: America/Jamaica (GMT-05:00)

Ce sujet contient 7 réponses, a 2 voix.

Dernière mise à jour par toolset-dave Il y a 7 années et 2 mois.

Assisté par: Shane.

Auteur
Publications
#572304

Hi, I have a CPT which contains Select Box, where I have a several states, default option is called "Pending" and when I create CPT in administration it will save correctly. But when I save CPT throught CRED content form, the state will not save. I need to have the state, but I don´t want to show it in frontend, it´s just for internal purpose. So how to save this state if the customer fills the CRED form without the select box. I thought that WP Toolset will automatically save the "Pending" state, because it is default option. Can you help me solve this problem? Thanks.

#572324

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Dave,

Thank you for contacting our support forum.

Actually no this wouldn't work as intended because the field is not on the form so its not being processed to recognise the default value.

What you can do however is to add a hidden generic field type and set it to the default value of that select field giving it the same slug as the select field.

This field won't show up on the frontend but when a user submits the form it should populate the select value.

Or what you can do is to add the field to the form and hide it with some css.

Thanks,
Shane

#572530

Hi Shane,

I tried to add generic field type as you wrote, but nothing is saved. Can you check the code:

[cred_generic_field field='wpcf-state' type='hidden' class='' urlparam='']
{
"required":0,
"validate_format":0,
"generic_type":"select",
"default":"pending"
}
[/cred_generic_field]
#572611

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Dave,

Would you mind providing me with admin access so that I can check on this further for you ?

The private fields have been enabled for your next response.

Thanks,
Shane

#572722

Hi Shane,

please enable me private message.

#572726

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Private fields enabled.

#573315

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Dave,

I've added the original field back to the form and marked it as hidden so it should now be working and setting the field to its default value.

Thanks,
Shane

#573602

Thank you, Shane.