Page 1 of 1

Understanding formbuilder

Posted: Fri Jul 09, 2010 1:57 am
by cronosmachine
Dear all,
Perhaps for you all will be easy to answer my question.
I have no problem creating formbuilder and show them entirely on content page using

Code: Select all

{FormBuilder form='sample_form'}
But I have problem to show them only particular field on content page.
What is the correct why to show it?
Let say if i have field name

Variable: {$name} / {$fld_80}
Field Represented: Name

Is it suppose to be like this?

Code: Select all

{FormBuilder form='sample_form' $name='default_value'}
or

Code: Select all

{FormBuilder form='sample_form' $fld_80='default_value'}
But i'm not able to show only particular name but instead all the form field was showed up.
Basically i want design my own form with text and design on content page.
I tried to look over and over on help module, but still no idea how to present only particular field.
Please correct me..

Thank you

Re: Understanding formbuilder

Posted: Fri Jul 09, 2010 4:17 am
by tyman00
You have to build the custom form in the Form Builder interface. You use {$fld_80} inside of the form Template and then call the Form in your page content. You can't use those fields outside of the Form Builder interface.

Re: Understanding formbuilder

Posted: Sat Jul 10, 2010 6:54 am
by Peciura
Lets say you have to fields on your form one is named "some_text" and id of another - "80"
{cms_module module='FormBuilder' form='sample_form' value_fld80='default_value' value_some_text='another_default_value'}
Note: Smarty parameter name should not be prepended with "$".

If you want to dynamically set field names and their default value, you have to create string that looks like Smarty code and then evaluate it.
{assign var='tmp' value=80}

{capture assign='temp'}
{literal}
{cms_module module='FormBuilder' form='sample_form' value_fld{/literal}{$tmp}{literal}='default_value' value_some_text='another_default_value'}
{/literal}
{/capture}

{eval var=$temp}
or if you like
{assign var='tmp' value=80}

{capture assign='temp'}
cms_module module='FormBuilder' form='sample_form' value_fld{$tmp}='default_value' value_some_text='another_default_value'}
{/capture}

{eval var="{$temp"}
Make sure you will not add extra spaces that could break code and Smarty delimiters match when evaluating.