[Solved] Formbuilder: possible to pass variables to dropdown

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
ElBombo
Forum Members
Forum Members
Posts: 24
Joined: Wed Oct 15, 2008 11:03 am

[Solved] Formbuilder: possible to pass variables to dropdown

Post by ElBombo »

Is there a way to pass (smarty)variables to the options of a dropdown created in Formbuilder through the standard way:

Code: Select all

{FormBuilder form='myForm' value_Dropdown=...}
Last edited by ElBombo on Wed Dec 22, 2010 8:20 pm, edited 1 time in total.
User avatar
M@rtijn
Power Poster
Power Poster
Posts: 706
Joined: Sat Nov 14, 2009 4:54 pm
Location: the Netherlands

Re: Formbuilder: possible to pass values to dropdown

Post by M@rtijn »

Wouldn't it be easier to do with FormBuilder itself?

You can add a dropdown item to your form, then can add values to that list in the options for that dropdown item.
Make your community a better place!
ElBombo
Forum Members
Forum Members
Posts: 24
Joined: Wed Oct 15, 2008 11:03 am

Re: Formbuilder: possible to pass values to dropdown

Post by ElBombo »

M@rtijn wrote: Wouldn't it be easier to do with FormBuilder itself?

You can add a dropdown item to your form, then can add values to that list in the options for that dropdown item.
Sorry wrote "values", as I meant "variables". So in that way you are right and I would have chosen that path, but I have a bunch of smarty variables that I would like to populate an option list.

At the moment I'm trying it to make it happen through this way
http://forum.cmsmadesimple.org/index.php/topic,38745.msg183494.html#msg183494

But the "Computed field" as suggested at point 4 gives me a value of "0" instead of the value of the option selected.
Last edited by ElBombo on Wed Dec 22, 2010 5:33 pm, edited 1 time in total.
ElBombo
Forum Members
Forum Members
Posts: 24
Joined: Wed Oct 15, 2008 11:03 am

Re: Formbuilder: possible to pass values to dropdown

Post by ElBombo »

ElBombo wrote: But the "Computed field" as suggested at point 4 gives me a value of "0" instead of the value of the option selected.
Strangely nothing is computed, I've even created some dummy fields with some integer values

Code: Select all

$fld_45+$fld_46
but it keeps on giving me "0" back. Am I missing something in the above code?
ElBombo
Forum Members
Forum Members
Posts: 24
Joined: Wed Oct 15, 2008 11:03 am

Re: Formbuilder: possible to pass variables to dropdown

Post by ElBombo »

I've added a javascript function to the page that sets the value of an hidden input when you changet the dropdown, which I've just put hardcoded in a "static textfield" with the smarty variables that set the values of the options.

Although not the way I liked to go (client-side), I put this one on [Solved]
Post Reply

Return to “Modules/Add-Ons”