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?
[solved] Form results to UDT for manually created form
[solved] Form results to UDT for manually created form
Last edited by Cerulean on Sun Jun 23, 2013 1:55 am, edited 1 time in total.
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
Re: Form results to UDT for manually created form
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}
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}
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Re: Form results to UDT for manually created form
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
POST array to UDT
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}
Code: Select all
{my_UDT my_param=$smarty.post}
Re: Form results to UDT for manually created form
Smarty variable to default values with Form Builder
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.
Code: Select all
{FormBuilder form='my_form' value_FIELDNAME=$my_variable}
Re: Form results to UDT for manually created form
Using value_FIELDNAME can be unreliable at times. Use value_fldNUMBER instead. Works fine.
Re: Form results to UDT for manually created form
I used value_FIELDNAME=$my_variable with no problems.
Re: Form results to UDT for manually created form
I do, doesn't work will have to re-test.psy wrote:Use value_fldNUMBER instead.