Page 1 of 1

Get value of "Redirect to Page Based on Pulldown" field?

Posted: Thu Jul 29, 2010 3:05 pm
by deejmer
This is a similar issue to this post I found:  http://forum.cmsmadesimple.org/index.php?topic=33670.0.  The problem is, the solution does not work for me.

If I use the default template token, I either get the email address to which the form was routed, or the word "array" prints.  I would like to print in the email; which option was selected as shown in the dropdown field (not the resulting email address).

I'm using this syntax in the template per the post above, but nothing it returned: {$fld_99_obj->value}

Can someone help?    Thanks!

Re: Get value of "Redirect to Page Based on Pulldown" field?

Posted: Fri Jul 30, 2010 6:53 am
by Peciura
Upload XML of the form so people would be able to import it on test site.
For me "array" sounds promising http://wiki.cmsmadesimple.org/index.php ... ode.2Fsite

Re: Get value of "Redirect to Page Based on Pulldown" field?

Posted: Fri Jul 30, 2010 12:24 pm
by deejmer
Attached is the XML of the form.....

Thanks!

Re: Get value of "Redirect to Page Based on Pulldown" field?

Posted: Fri Jul 30, 2010 2:23 pm
by Peciura
Smth went wrong with XML there is no field names. ATM i am using my own naming. Can you write field names and ids by hand to forum (just to make things clear)?
You want to access email subject of corresponding address, don't you ?

EDIT:
OK. so i added field "*Call A User Defined Tag With the Form Results" and "Export form reference to UDT as $params['FORM']? " is on.
UDT you call in this field contains code
$search_field_id = '99'; /*field id "*Email Results Based on Pulldown" */
$session_variable = 'destination_subject'; /* session member to store subject */

$search_field_value = 'fld_'.$search_field_id;

foreach($params['FORM']->Fields as $key=>$one_field){
if (!empty($one_field->Name) && !empty($one_field->Id) && $one_field->Id==$search_field_id){
$field_number = $key;
break;
}
}

$email_key = array_search(${$search_field_value}, $params['FORM']->Fields[$field_number]->Options['destination_address']);
$_SESSION[$session_variable] = $params['FORM']->Fields[$field_number]->Options['destination_subject'][$email_key];
display value in emails and submission template
{$smarty.session.destination_subject}
EDIT: rewritten UDT so it is enough to supply id of field "*Email Results Based on Pulldown".

Re: Get value of "Redirect to Page Based on Pulldown" field?

Posted: Fri Jul 30, 2010 3:50 pm
by deejmer
Pecuria, thanks first off for helping me troubleshoot.  Its much appreciated.    Since the XML didn't work, I'm including two screenshots; one of the field options, and another showing the advanced tab for the email template.

Let me know if you need anything else.

Thanks!

(EDIT) on the template screenshot, i realized that the variable {$fld_99} was missing the closing bracket, but fixing it didn't get me any closer.  I still only get the value of the field as the email address to which the email is being routed; not the value as selected by the user in the dropdown.

Re: Get value of "Redirect to Page Based on Pulldown" field?

Posted: Fri Jul 30, 2010 5:21 pm
by Peciura
Just rewritten UDT so it is enough to supply id of field "*Email Results Based on Pulldown".

Re: Get value of "Redirect to Page Based on Pulldown" field?

Posted: Fri Jul 30, 2010 5:52 pm
by deejmer
Awesome!  This looks nice.....Problem though, I dont see the option or indication:  "Export form reference to UDT as $params['FORM']? "

I'm running an older version of the form builder (0.4.4), so wonder if the option is there.  Where do you find it?  Maybe I need to update this module....

Re: Get value of "Redirect to Page Based on Pulldown" field?

Posted: Fri Jul 30, 2010 7:25 pm
by Peciura
It is FormBuilder 0.6.2. You have to upgrade.