akirkend Posted November 9, 2010 Report Share Posted November 9, 2010 This is my deployment code. Click here to load this Caspio Online Database app. In this code their is one table and three columns. The jScript below is suppose to refrence the example I left above. The script is suppose to check the first dropdown for a country and when the right option is choosen it disables dropdown 2. I have been playing with the script and need other input. var dropdown1 = "@:Country"; var dropdown2 = "@field:State"; var rightSelection = "United States"; function secondDropdown() { var firstDropdown = document.getElementsByName(dropdown1); var firstSelection = firstDropdown[0].options[firstDropdown[0].selectedIndex].text; var secondDropdown = document.getElementsByName(dropdown2); if (firstSelection != rightSelection) secondDropdown[0].disabled=true; else secondDropdown[0].disabled=false; } onload=secondDropdown; /*(4) Everytime a selection is made, the function secondDropdown() is called. */ document.getElementById("caspioform").Value1_1.onchange=secondDropdown; Quote Link to comment Share on other sites More sharing options...
MayMusic Posted November 9, 2010 Report Share Posted November 9, 2010 In this page you only have three text boxes? Value1_1, Value2_1 and Value3_1 . If you change the text box to drop down would be easier to work on your JS. Quote Link to comment Share on other sites More sharing options...
akirkend Posted November 13, 2010 Author Report Share Posted November 13, 2010 Apple Banana Orange Quote Link to comment Share on other sites More sharing options...
akirkend Posted November 13, 2010 Author Report Share Posted November 13, 2010 Scrap what my last reply was. I posted the wrong code. below is the correct code. problem im having is i can get it to block/hide fields on load. I cant seem to get it to work on change. any ideas? /*(1) Value1_1 is a reference to the first dropdown element */ var dropdown1 = '[@field:GSAO_recruiting_report_Viable]'; /*(2) Value2_1 is a reference to the second drodown element */ var dropdown2 = '[@field:GSAO_recruiting_report_Reason_if_no1]'; /*(3) The text in the first dropdown which if not selected will disable the second dropdown */ var rightSelection = 'no'; document.write (dropdown1) function secondDropdown() { var firstDropdown = document.getElementsByName("EditRecordGSAO_recruiting_report_Viable"); var firstSelection = firstDropdown[0].options[firstDropdown[0].selectedIndex].text; var secondDropdown = document.getElementsByName("EditRecordGSAO_recruiting_report_Reason_if_no1"); if (firstSelection != rightSelection) secondDropdown[0].disabled=true; else /*secondDropdown[0].style.display ="none";*/ secondDropdown[0].style.display =""; } onload=secondDropdown; /*(4) Everytime a selection is made, the function secondDropdown() is called. */ document.getElementById("caspioform").firstSelection.onchange=secondDropdown; Quote Link to comment Share on other sites More sharing options...
bahar_vm Posted November 17, 2010 Report Share Posted November 17, 2010 You do not need to change the Value1_1 to the field name. The reference to the first element on search form is value1_1, second element value2_1 and so on... Your code should be similar to the one at viewtopic.php?f=14&t=12178 Best, Bahar M. 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.