Skip Navigation

[Résolu] Pass value to number field in CRED

This support ticket is created Il y a 4 années et 3 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Marqué : 

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

Dernière mise à jour par larryL Il y a 4 années et 3 mois.

Assisté par: Christian Cox.

Auteur
Publications
#1728591

I have a select field with several options. Based upon the selection I want to populate a number field in the form with a different numerical value. So if the user select 'option a' it inserts a value of '1' in the number field. But if the user selects 'option b' it inserts a value of '.5' in the number field. Is this possible?

#1729909

Hello, there's nothing exactly like this built-in to Forms, unfortunately. You have the ability to conditionally display content based on a selected field value using conditional groups, but those groups do not help you set an arbitrary value in another field. If you want to programmatically set field values based on the selection in another field, you would need custom JavaScript that sets up some event listeners and triggers field value updates. This type of customization falls outside the scope of support we provide here in the forums, but you may be able to find similar examples in Stack Overflow or another online coding resource.

#1729997

Do you think I'm over designing this function? IOW is there a more practical way to do this within the boundaries of what toolset/CRED could do?

#1730017

Is there a more practical way to do what, exactly? I'm not fully aware of what you want to achieve with this, other than setting one custom field value when another custom field value changes in a Form. That seems pretty cut-and-dry, but there's no elegant way to do it built-in to Toolset. It will require custom code either on the front-end - to manipulate the field values before Form submission...or on the back-end - to manipulate the field values after Form submission.

You might consider whether or not a second field is really needed - if the second field value is fully dependent upon the first field then maybe it's not required.

Other than that, I'd need to know more about what you want to achieve (the big picture) to provide some alternatives. Let me know your thoughts.

#1731221

I think you have answered my question. Thanks!