Hello-
I have a FormBuilder form with three dispositions... email results to set address, save to flat file, and "redirect to page based on pulldown". The redirect field is called "Register For" , and in the email output templates variable list it is shown as {$register_for} / {$fld_44}.
When I try to format the email or the flat file, the output of {$fld_44} is simply the string "Array" without the quotes. I don't see what choice the user made.
How do I access the value of {$register_for} / {$fld_44} so I can see what choice the user made?
Why I want to do this (since people often ask background info on a problem): The form is being used to register persons for seminars. The seminar choices are in the "Register For" field. Each seminar has it's own landing page with further information, with a file they can click in iCalendar format to add the date to their preferred calendar app. That is why I need the redirect based on pulldown, and also why I need to know what choice they made (so I know what seminar they are registering for).
Thank you,
Vaughn
[Solved] [FormBuilder] Get value of "Redirect to Page Based on Pulldown" field?
[Solved] [FormBuilder] Get value of "Redirect to Page Based on Pulldown" field?
Last edited by vaughnt on Tue May 12, 2009 3:21 pm, edited 1 time in total.
Re: [Solved] [FormBuilder] Get value of "Redirect to Page Based on Pulldown" field?
Ok, found a solution here.
I don't think that Formbuilder makes accessible the text value of the option that was chosen. However, by using {$fld_44_obj->value} , it spits out a number. It took me a bit to figure out what this number represented.... it is the ID of the page that the user was redirected to. Unfortunately, this number is of little use to someone processing class registrations, and I couldn't figure how to convert the ID to the name of the target page in the context of a formbuilder output template, so I did it a different way.
I used javascript to get the selected text value onChange, and write it to a hidden field. Here is a short version of the working form:
This works well enough.
I don't think that Formbuilder makes accessible the text value of the option that was chosen. However, by using {$fld_44_obj->value} , it spits out a number. It took me a bit to figure out what this number represented.... it is the ID of the page that the user was redirected to. Unfortunately, this number is of little use to someone processing class registrations, and I couldn't figure how to convert the ID to the name of the target page in the context of a formbuilder output template, so I did it a different way.
I used javascript to get the selected text value onChange, and write it to a hidden field. Here is a short version of the working form:
Code: Select all
<form id="m4moduleform_2" method="post" action="index.php" enctype="multipart/form-data">
Register for:
<select name="m4fbrp__44" onChange="var w = document.getElementById('m4moduleform_2').m4fbrp__44.selectedIndex; var selected_text = getElementById('m4moduleform_2').m4fbrp__44.options[w].text; getElementById('m4moduleform_2').m4fbrp__45.value = selected_text;">
<option value="" selected="selected"> Select One</option>
<option value="1">Class1</option>
<option value="2">Class2</option>
<option value="3">Class3</option>
<option value="4">etc.</option>
</select>
<input type="hidden" name="m4fbrp__45" value="" />
...
</form>
-
- Power Poster
- Posts: 272
- Joined: Wed Sep 13, 2006 4:41 pm
- Location: Belgium
Re: [Solved] [FormBuilder] Get value of "Redirect to Page Based on Pulldown" field?
Hello !
Vaughn, thank a lot for your post. It was the beginning of the solution I needed.
I've implemented it and have a suggestion to improve using Smarty in place of javascript to convert the ID to something more convivial.
I put this code in my email template :
{if $fld_38_obj->value eq 170}
Module 1
{elseif $fld_38_obj->value eq 167}
Module 2
{elseif $fld_38_obj->value eq 168}
Module 3
{elseif $fld_38_obj->value eq 175}
Module 3
{else}
Other
{/if}
Of course I hardcoded. But whe are in progress, don't we ?
Vaughn, thank a lot for your post. It was the beginning of the solution I needed.
I've implemented it and have a suggestion to improve using Smarty in place of javascript to convert the ID to something more convivial.
I put this code in my email template :
{if $fld_38_obj->value eq 170}
Module 1
{elseif $fld_38_obj->value eq 167}
Module 2
{elseif $fld_38_obj->value eq 168}
Module 3
{elseif $fld_38_obj->value eq 175}
Module 3
{else}
Other
{/if}
Of course I hardcoded. But whe are in progress, don't we ?