ppbb123 Posted January 27, 2014 Report Share Posted January 27, 2014 Is it possible after the end-user clicks the Submit button, I can dynamically redirect a user to a specific URL based on the checkboxes' value? For example: There are two checkboxes, "Search1" and "Search2". If "Search1" is checked, form submission goes to "www.gooogle.com". If "Search2" is checked, it goes to "yahoo.com". If neither is checked, it goes to "bings.com" If both are checked, it goes to "Home.com" . Quote Link to comment Share on other sites More sharing options...
0 HongTaiLang Posted January 27, 2014 Report Share Posted January 27, 2014 1. Create a Virtual field, the destination can be redirected to the value of that Virtual field. 2. Use the following code in the Footer of your DataPages. The value of Virtual1 depends on the checkboxes : <script> function myFunction() { var x = document.getElementById("InsertRecordSearch1"); var y = document.getElementById("InsertRecordSearch2"); if ((x.checked == true) && (y.checked == false)){ document.getElementById("cbParamVirtual1").value = "http://www.google.com/";} else if ((x.checked == false) && (y.checked == true)){ document.getElementById("cbParamVirtual1").value = "http://www.yahoo.com/";} else if ((x.checked == false) && (y.checked == false)){ document.getElementById("cbParamVirtual1").value = "https://www.bings.com/";} else { document.getElementById("cbParamVirtual1").value = "https://www.home.com/";} } document.getElementById("caspioform").onsubmit=myFunction; </script> 3. You can configure what happens after the form is submitted. In the Destination and Triggers page, select Go to a new page as the destination and enter or insert the parameter name in Page URL which is [@Virtual1] in this case. Quote Link to comment Share on other sites More sharing options...
0 luizcruz Posted February 9, 2014 Report Share Posted February 9, 2014 1. Create a Virtual field, the destination can be redirected to the value of that Virtual field. 2. Use the following code in the Footer of your DataPages. The value of Virtual1 depends on the checkboxes : <script> function myFunction() { var x = document.getElementById("InsertRecordSearch1"); var y = document.getElementById("InsertRecordSearch2"); if ((x.checked == true) && (y.checked == false)){ document.getElementById("cbParamVirtual1").value = "http://www.google.com/";} else if ((x.checked == false) && (y.checked == true)){ document.getElementById("cbParamVirtual1").value = "http://www.yahoo.com/";} else if ((x.checked == false) && (y.checked == false)){ document.getElementById("cbParamVirtual1").value = "https://www.bings.com/";} else { document.getElementById("cbParamVirtual1").value = "https://www.home.com/";} } document.getElementById("caspioform").onsubmit=myFunction; </script> 3. You can configure what happens after the form is submitted. In the Destination and Triggers page, select Go to a new page as the destination and enter or insert the parameter name in Page URL which is [@Virtual1] in this case. Hi, I would like to redirect the user to a specific page after the form is submitted according to the option selected in a dropdown! I tried the following script but unfortunately it´s not working yet: 1) I created a Virtual field to redirect to the value of this Virtual field. 2) I Used the following code in the Footer of my DataPage. The value of Virtual1 should be defined by the dropdown selection! <script language="JavaScript"> function myFunction() { var x = document.getElementByName("InsertRecordMyOption")[0]; if (x == 'Yes'){ document.getElementById("cbParamVirtual1").value = "http://www.google.com/";} else if (x == 'No'){ document.getElementById("cbParamVirtual1").value = "http://www.yahoo.com/";} else if (x == 'Maybe'){ document.getElementById("cbParamVirtual1").value = "https://www.bings.com/";} } document.getElementById("caspioform").onsubmit=myFunction; </script> I set the [@Virtual1] field as form element "Hidden" could someone give me a hand? Regards! Luiz Quote Link to comment Share on other sites More sharing options...
0 MayMusic Posted February 12, 2014 Report Share Posted February 12, 2014 The script looks ok and you can select this virtual field as the destination. Can you provide the URL of the page which you have this script on? Quote Link to comment Share on other sites More sharing options...
0 MayMusic Posted February 12, 2014 Report Share Posted February 12, 2014 You still need to change the code to document.getElementsByName("InsertRecordMyOption")[0].value; you are missing s Quote Link to comment Share on other sites More sharing options...
0 roelmagpoc Posted February 12, 2014 Report Share Posted February 12, 2014 Can you help me with this script? I created a hidden virtual field (Virtual1) that should contain my links below based on given conditions. Then, I want to use that Virtual1 field to redirect the user upon form submission. I tried putting the codes in an HTML block then in the Footer but it seems like the Virtual1 field is not getting any value. Please help. <script type="text/javascript"> var WorkOrderType = '[@field:WorkOrderType]'; var WorkOrderDetail = '[@field:WorkOrderDetail]'; if (WorkOrderDetail == 'M1 TDM') { document.getElementById("cbParamVirtual1").value = "http://b6.caspio.com/dp.asp?AppKey=b9443000bc1de4154c364d53a0b5&WorkOrderId=[@field:WorkOrderId]"; } Else if (WorkOrderDetail == 'M1 Fiber') { [@Virtual1]="http://b6.caspio.com/dp.asp?AppKey=b94430008aaa7fbc77eb48df83f8&WorkOrderId=[@field:WorkOrderId]"; } Else { [@Virtual1]="http://b6.caspio.com/dp.asp?AppKey=b9443000fa23580f2eda4a41bb40&WorkOrderId=[@field:WorkOrderId]"; } </script> Quote Link to comment Share on other sites More sharing options...
0 luizcruz Posted February 13, 2014 Report Share Posted February 13, 2014 You still need to change the code to document.getElementsByName("InsertRecordMyOption")[0].value; you are missing s Hi MayMusic! Thank you very much! Regards! Luiz Quote Link to comment Share on other sites More sharing options...
0 MayMusic Posted February 24, 2014 Report Share Posted February 24, 2014 heisenberg can you provide me the link to the page? Quote Link to comment Share on other sites More sharing options...
0 roelmagpoc Posted February 25, 2014 Report Share Posted February 25, 2014 heisenberg can you provide me the link to the page? My code is working now by combining all the examples above and using getElementsByName as you suggested. The big thing I was missing was defining the function and running it when needed. Also, i thought "caspioform" needed to be changed to my actual form name. Thanks! Quote Link to comment Share on other sites More sharing options...
0 MayMusic Posted March 14, 2014 Report Share Posted March 14, 2014 "caspioform" is the ID of Caspio DataPages Quote Link to comment Share on other sites More sharing options...
0 Aurora Posted September 28, 2015 Report Share Posted September 28, 2015 If you want to redirect a User if he selects special checkbox you can use the following script: <SCRIPT LANGUAGE="JavaScript"> function myFunction() { if (document.getElementById('InsertRecordcheckbox').checked) { window.location="http://www.google.com.ua"; return false; } } document.getElementById('caspioform').onsubmit= myFunction; </SCRIPT> Hope it helps. Aurora Quote Link to comment Share on other sites More sharing options...
0 balmerhevi Posted November 9, 2016 Report Share Posted November 9, 2016 Try this one, more about...URL Redirect Balmer Quote Link to comment Share on other sites More sharing options...
0 Kurumi Posted April 29, 2022 Report Share Posted April 29, 2022 Hi - Just an update, you may now use Virtual Field and Calculated Value on this workflow. You may use a Virtual Field as a holder or identifier of the value from the dropdown and then set the Form Element as Calculated Value. In the Formula, you may use a CASE WHEN statement like: CASE WHEN [@FIELDNAME] = 'value' THEN 'https://www.google.com/' WHEN [@FIELDNAME] = 'value 1' THEN 'https://caspio.com/' ELSEhttps://www.youtube.com/ END After setting up the formula, on the Destination and Messaging configuration screen, set the Destination after the record submits to 'Go to a New Page'. Lastly, in the Page URL, call the Virtual Field from the field picker. For reference, you may check these links: https://howto.caspio.com/datapages/datapage-components/virtual-fields/https://howto.caspio.com/datapages/datapage-components/calculated-values/https://howto.caspio.com/function-reference/https://howto.caspio.com/datapages/forms/submission-forms/#:~:text=to make conditional.-,Destination and Emails,-Here you can Quote Link to comment Share on other sites More sharing options...
Question
ppbb123
Is it possible after the end-user clicks the Submit button, I can dynamically redirect a user to a specific URL based on the checkboxes' value?
For example:
There are two checkboxes, "Search1" and "Search2".
If "Search1" is checked, form submission goes to "www.gooogle.com".
If "Search2" is checked, it goes to "yahoo.com".
If neither is checked, it goes to "bings.com"
If both are checked, it goes to "Home.com" .
Link to comment
Share on other sites
12 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.