Page 1 of 1
[Solved] Formbuilder: possible to pass variables to dropdown
Posted: Wed Dec 22, 2010 4:23 pm
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=...}
Re: Formbuilder: possible to pass values to dropdown
Posted: Wed Dec 22, 2010 4:57 pm
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.
Re: Formbuilder: possible to pass values to dropdown
Posted: Wed Dec 22, 2010 5:12 pm
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.
Re: Formbuilder: possible to pass values to dropdown
Posted: Wed Dec 22, 2010 6:42 pm
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
but it keeps on giving me "0" back. Am I missing something in the above code?
Re: Formbuilder: possible to pass variables to dropdown
Posted: Wed Dec 22, 2010 8:20 pm
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]