I'm planning a form which includes a select element (pulldown) for choosing from a list of items.
The items all have their own pages, and I'd like to provide a link on each of those pages to the form that will set the pulldown to the relevant item. i.e. applying selected="selected" to a specific option.
The variable for the pulldown is {$fld_10}, and there are 15 options in the pulldown, so how could I link to a page containing the following form tag to set the pulldown to option 5?
{cms_module module='FormBuilder' form='events'}
[solved] Formbuilder - setting selected="selected" from link
[solved] Formbuilder - setting selected="selected" from link
Last edited by Jonny on Sat Dec 17, 2011 2:46 pm, edited 1 time in total.
Re: Formbuilder - setting selected="selected" from link
Code: Select all
{if $smarty.get.office} {cms_module module='FormBuilder' form='contact_us' value_fld15=$smarty.get.office} {else} {cms_module module='FormBuilder' form='contact_us'} {/if}
Code: Select all
/contact-form/?office=2
http://www.goringberry.co.uk/contact/of ... harrogate/
Click the contact us link
Re: Formbuilder - setting selected="selected" from link
Many thanks for your prompt response to my PM and the working example.
Re: Formbuilder - setting selected="selected" from link
Your welcome.
You don't have to pass a number just whatever is the value of the option you want selected. If it contains spaces then you will need to use |replace if using get instead of post. You will also need I seem to remember assign it to a variable as you cannot do the replace in the form builder smarty tag. i.e.
You don't have to pass a number just whatever is the value of the option you want selected. If it contains spaces then you will need to use |replace if using get instead of post. You will also need I seem to remember assign it to a variable as you cannot do the replace in the form builder smarty tag. i.e.
Code: Select all
?office=this_is_my_value
{if $smarty.get.office}
{assign var=tmp value=$smarty.get.office|replace:'_':' '}
{cms_module module='FormBuilder' form='contact_us' value_fld15=$tmp}
{else}
{cms_module module='FormBuilder' form='contact_us'}
{/if}