This forum is no longer open and is for reading/searching only.
Please use our new MachForm Community Forum instead.
MachForm Community Forums » MachForm 2
Multiple Redirect URL's
Started 17 years ago by bmcrec | 7 posts |
-
I have a form that I’m using to register request for my software demo. It comes in two versions Mac and PC. Is there a way to have a drop down menu in the form where the user selects (let’s say) Mac or PC and If a user selects Mac the Redirect URL goes to one page and if the user selects PC the Redirect URL goes to a different page after the form is submitted?
Posted 17 years ago # -
This would require some hack.
Let say you have a form with id = 2 and your dropdown is having id = 'element_3' (view the HTML source of your form to see it).
And your dropdown values are:
1 - PC
2 - MACEdit your includes/post-functions.php file, search around line 910 - 914:
if(empty($error_elements) && empty($process_result['custom_error'])){ $process_result['status'] = true; }else{ $process_result['status'] = false; }
Modify the code above to be like this:if(empty($error_elements) && empty($process_result['custom_error'])){ $process_result['status'] = true; if($form_id == 2){ if($table_data['element_3'] == 1){ $process_result['form_redirect'] = 'http://www.pc.com'; }elseif ($table_data['element_3'] == 2){ $process_result['form_redirect'] = 'http://www.mac.com'; } } }else{ $process_result['status'] = false; }
Adjust the id values above as needed.MachForm Founder
Posted 17 years ago # -
Thanks yuniar that worked perfectly. Your product is amazing.
I was wondering if it would be possible to take this one step further.
I have tweaked the includes/helper-functions.php to send an email back to the form submitter and it works great. Since I now have separate Redirect URL’s based on the Mac or PC dropdown value. Is it possible to send a separate email back to form submitters based on this same value? Mac users get one email and PC users get another.
ThanksPosted 17 years ago # -
Ok, I assume you have done the modification as explained here:
http://www.appnitro.com/forums/topic/sending-html-email-back-to-submitter?replies=29You will need to modify your hooks/custom_hooks.php file.
Change this part:$email_content =<<<EOT ...Put your HTML content here..... EOT; $result['body'] = $email_content;
To be something like this:
$email_content_1 =<<<EOT ...Put your PC content here..... EOT; $email_content_2 =<<<EOT ...Put your Mac content here..... EOT; if($user_input['element_3'] == 1){ $result['body'] = $email_content_1; }elseif($user_input['element_3'] == 2){ $result['body'] = $email_content_2; }
That should send different emails.MachForm Founder
Posted 17 years ago # -
Once again, everything worked perfectly.
ThanksPosted 17 years ago # -
Yuniar, can your reply 2 above work if I wanted to use this feature as a multiple choice field? I would like to display my choices and when the radio button is selected and submitted it redirects to the appropriate URL.
Posted 12 years ago # -
The above should work with multiple choice as well. However, the code is applicable for version 2, so the line numbers most likely has been changed if you are using version 3.
MachForm Founder
Posted 12 years ago #
Reply
You must log in to post.