[solved] Form results to UDT for manually created form

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
Cerulean
Forum Members
Forum Members
Posts: 172
Joined: Mon Nov 01, 2010 8:56 am

[solved] Form results to UDT for manually created form

Post 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?
Last edited by Cerulean on Sun Jun 23, 2013 1:55 am, edited 1 time in total.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Form results to UDT for manually created form

Post 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}
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.
Cerulean
Forum Members
Forum Members
Posts: 172
Joined: Mon Nov 01, 2010 8:56 am

Re: Form results to UDT for manually created form

Post 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

Code: Select all

{my_UDT my_param=$smarty.post}
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am

Re: Form results to UDT for manually created form

Post 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.
psy
Power Poster
Power Poster
Posts: 463
Joined: Sat Jan 22, 2005 11:19 am

Re: Form results to UDT for manually created form

Post by psy »

Using value_FIELDNAME can be unreliable at times. Use value_fldNUMBER instead. Works fine.
Cerulean
Forum Members
Forum Members
Posts: 172
Joined: Mon Nov 01, 2010 8:56 am

Re: Form results to UDT for manually created form

Post by Cerulean »

I used value_FIELDNAME=$my_variable with no problems.
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am

Re: Form results to UDT for manually created form

Post by applejack »

psy wrote:Use value_fldNUMBER instead.
I do, doesn't work will have to re-test.
Post Reply

Return to “CMSMS Core”