Page 1 of 1
[solved] Form results to UDT for manually created form
Posted: Sun Jun 16, 2013 4:19 am
by Cerulean
Form Builder has an option "Call a User Defined Tag with the form results".
I need to create a form manually, not using Form Builder, as I need to set the default input values using smarty variables in the page and I don't think that is possible using Form Builder. How can I call a UDT with the results of a manually created form?
Re: Form results to UDT for manually created form
Posted: Sun Jun 16, 2013 4:49 am
by calguy1000
You need to read a: the smarty manual, and b: the formbuilder help. Yes, you can provide default values to a formbuilder form based on smarty variables.
And to answer the next question. you point the form action at a URL which will land on a CMSMS page. all you have to do is make sure that the UDT is executed on that page.
something like:
{if isset($smarty.get.foo) && $smarty.get.foo == 'bar'}
<p>You entered: {$smarty.post.text1}</p>
{my_udt}
{else}
<form action="
http://www.mysite.com/page.html?foo=bar">
<input type="text" name="text1" value="foo"/>
<input type="submit" value="submit">
</form>
{/if}
Re: Form results to UDT for manually created form
Posted: Sun Jun 16, 2013 8:44 am
by Cerulean
Thanks for the advice - it helped me to get both options working.
To spell it out for anyone else wondering...
Smarty variable to default values with Form Builder
Code: Select all
{FormBuilder form='my_form' value_FIELDNAME=$my_variable}
POST array to UDT
Re: Form results to UDT for manually created form
Posted: Thu Jun 20, 2013 10:58 am
by applejack
Smarty variable to default values with Form Builder
Code: Select all
{FormBuilder form='my_form' value_FIELDNAME=$my_variable}
The last time I tried this on some existing sites and new builds it was broken in Formbuilder. I would be interested to know if you actually have this working.
Re: Form results to UDT for manually created form
Posted: Thu Jun 20, 2013 10:02 pm
by psy
Using value_FIELDNAME can be unreliable at times. Use value_fldNUMBER instead. Works fine.
Re: Form results to UDT for manually created form
Posted: Thu Jun 20, 2013 10:27 pm
by Cerulean
I used value_FIELDNAME=$my_variable with no problems.
Re: Form results to UDT for manually created form
Posted: Fri Jun 21, 2013 1:26 am
by applejack
psy wrote:Use value_fldNUMBER instead.
I do, doesn't work will have to re-test.