Tips and Tricks HQ Support Portal › Forums › WP eMember › eMember Form Builder : custom value to SELECT
- This topic has 3 replies, 2 voices, and was last updated 3 years, 6 months ago by
wzp.
-
AuthorPosts
-
June 9, 2022 at 10:44 am #84445
kreart
SpectatorHi !
Until now, I was using the custom field within WP eMember and I used ID in dropdown list like this :
9793=>Acton Vale, 9794=>Alma, 9795=>Asbestos
Now I would like to use the eMember Form Builder addon, but I don’t have the possibility to set a different value than what the displaying one. Is it possible ?
June 9, 2022 at 5:01 pm #84448wzp
ModeratorIs this what you want to kdo?
June 9, 2022 at 5:55 pm #84450kreart
SpectatorNo, what I want to do is put a number (the ID of something else) that corresponds to the displayed item in the option of the SELECT in the form builder addon. I put you screenshots of the thing in this link :
https://www.dropbox.com/t/GgyxCY6hnLwu2GT6
I did it with the custom field, but now I would like to do the same with Form Builder Addon. I need to retrieve the number in another function later on.
June 13, 2022 at 2:12 pm #84460wzp
ModeratorThere is an “easy” and a “hard” solution to what you are asking for:
- “Hard” — When you design a form, using the Form Builder, it stores the design specifications for your forms in the MySQL database; and when the form is displayed, those specifications are interpreted by a p-code like system, that dynamically constructs the form code. It is very difficult to modify the addon, to work the way that you would like it to.
- “Easy” — Because your dropdown choices are known in advance (Option1, Option2, et al); at the appropriate point in your own code, simply retrieve the field “text value” and run it through a CASE statement, that will transliterate the human-readable dropdown selection to whatever desired numerical value is required.
In the cases where you are using multiple values for the same dropdown item, because you are using dirrent forms for each membership level, simply have a hidden “level code” field as part of the form. You’d then use a nested IF/CASE statement, similar to:
IF level-code = 1 THEN
CASE
ELSE IF level-code = 3 THEN
CASE
- “Hard” — When you design a form, using the Form Builder, it stores the design specifications for your forms in the MySQL database; and when the form is displayed, those specifications are interpreted by a p-code like system, that dynamically constructs the form code. It is very difficult to modify the addon, to work the way that you would like it to.
-
AuthorPosts
- You must be logged in to reply to this topic.