khosseini Posted July 21, 2010 Report Share Posted July 21, 2010 Afternoon Everyone, Here is my issue. I have a Permissions form I am creating. Where the user must give permission that his/her data is able to be used for our research. If they select "Yes" they will be directed to an info page, if they select "No" they are directed to a we cannot allow you to complete the survey, would you like to reconsider page. I am a beginner JavaScript user...and have a basic idea of JavaScript that should be used, found an example elsewhere in the site, but have changed it around so much I have no idea why it isn't working. So any help would be appreciated: function dynamic_URL() { if (Permission=="Yes") { window.open("http://www.cohs.uci.edu/nursing/VTE/VTE3.htm"); } else { window.open("http://www.cohs.uci.edu/nursing/VTE/VTE7.htm"); } } document.getElementById("caspioform").onsubmit = dynamic_URL; Thanks! Kendra Hosseini Programmer Analyst UCI - Program in Nursing Science Quote Link to comment Share on other sites More sharing options...
shengnandou Posted July 21, 2010 Report Share Posted July 21, 2010 Hi Kendra, I understand that this issue is solved by the program we discussed. Let me share the code here for others' reference, too. The basic idea is to assign the correct URL link to a virtual field (cbParamVirtual1) based on user selection, and then use this virtual field as the destination of the current DataPage. function redirect() { var YesOrNo = document.getElementById("InsertRecordFIELDNAME"); var w = YesOrNo.selectedIndex; var selected_text = YesOrNo.options[w].text; if (selected_text == "Yes"){ document.getElementById("cbParamVirtual1").value = "http://www.cohs.uci.edu/nursing/VTE/VTE3.htm"; } else{ document.getElementById("cbParamVirtual1").value = "http://www.cohs.uci.edu/nursing/VTE/VTE7.htm"; } } document.getElementById("caspioform").onsubmit = redirect; By changing the 'FIELDNAME' to the correct field name and change the URLs, this piece of code will work for a submission form. Quote Link to comment Share on other sites More sharing options...
khosseini Posted July 21, 2010 Author Report Share Posted July 21, 2010 Thanks so much! My user was very very pleased! Quote Link to comment Share on other sites More sharing options...
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.