Pavlos1316 Posted June 12, 2008 Share Posted June 12, 2008 Hi I am trying to use a jsp function in a checkbox form.php (when you check one box the others in the same row you will not be able to check them). It doesn't seem to work but I don't get any errors either. Is that another way to call jsp function inside php? Here is how I have it: <head> jsp script function validateCheck(); </head> <body> form... bla bla bla id= "checkbox".... etc onclick="validateCheck();" </body> Thank you Quote Link to comment Share on other sites More sharing options...
kbh43dz_u Posted June 12, 2008 Share Posted June 12, 2008 are you talking about javascript or java-server-pages (jsp)? your javascript has to be in javascript-tags like <script>function myFunction(){}</script> for more details we need your script. Quote Link to comment Share on other sites More sharing options...
Pavlos1316 Posted June 12, 2008 Author Share Posted June 12, 2008 Here is the code.. Big one but is just repeating after the first lines.. Note that I am quite new with this. Can you help? <script type="text/javascript"> function validateCheck() { formObj = document.getElementById('grid'); var totalCount = 0; var rowCount = new Array(); rowCount[0] = 0; rowCount[1] = 0; rowCount[2] = 0; rowCount[3] = 0; rowCount[4] = 0; rowCount[5] = 0; rowCount[6] = 0; rowCount[7] = 0; for (var i=1; i<=24; i++) { if (formObj['B'+i].checked) { totalCount++; rowCount[(Math.ceil(i/8)-1)]++; } } var disableState = new Array(); disableState[0] = false; disableState[1] = false; disableState[2] = false; disableState[3] = false; disableState[4] = false; disableState[5] = false; disableState[6] = false; disableState[7] = false; //Determine rows to disable if (totalCount==9) { disableState[0] = true; disableState[1] = true; disableState[2] = true; disableState[3] = true; disableState[4] = true; disableState[5] = true; disableState[6] = true; disableState[7] = true; } else { if (rowCount[0]==2 || (rowCount[0]==1 && (rowCount[1]==2 || rowCount[2]==2 || rowCount[3]==2 || rowCount[4]==2 || rowCount[5]==2 || rowCount[6]==2 ||rowCount[7]==2))) { disableState[0] = true; } if (rowCount[1]==2 || (rowCount[1]==1 && (rowCount[0]==2 || rowCount[2]==2 || rowCount[3]==2 || rowCount[4]==2 || rowCount[5]==2 || rowCount[6]==2 ||rowCount[7]==2))) { disableState[1] = true; } if (rowCount[2]==2 || (rowCount[2]==1 && (rowCount[0]==2 || rowCount[1]==2 || rowCount[3]==2 || rowCount[4]==2 || rowCount[5]==2 || rowCount[6]==2 ||rowCount[7]==2))) { disableState[2] = true; } if (rowCount[3]==2 || (rowCount[3]==1 && (rowCount[0]==2 || rowCount[1]==2 || rowCount[2]==2 || rowCount[4]==2 || rowCount[5]==2 || rowCount[6]==2 ||rowCount[7]==2))) { disableState[3] = true; } if (rowCount[4]==2 || (rowCount[4]==1 && (rowCount[0]==2 || rowCount[1]==2 || rowCount[2]==2 || rowCount[3]==2 || rowCount[5]==2 || rowCount[6]==2 ||rowCount[7]==2))) { disableState[4] = true; } if (rowCount[5]==2 || (rowCount[5]==1 && (rowCount[0]==2 || rowCount[1]==2 || rowCount[2]==2 || rowCount[3]==2 || rowCount[4]==2 || rowCount[6]==2 ||rowCount[7]==2))) { disableState[5] = true; } if (rowCount[6]==2 || (rowCount[6]==1 && (rowCount[0]==2 || rowCount[1]==2 || rowCount[2]==2 || rowCount[3]==2 || rowCount[4]==2 || rowCount[5]==2 ||rowCount[7]==2))) { disableState[6] = true; } if (rowCount[7]==2 || (rowCount[7]==1 && (rowCount[0]==2 || rowCount[1]==2 || rowCount[2]==2 || rowCount[3]==2 || rowCount[4]==2 || rowCount[5]==2 ||rowCount[6]==2))) { disableState[7] = true; } } //Disable/enable unchecked boxes for (var i=1; i<=24; i++) { if (!formObj['B'+i].checked) { formObj['B'+i].disabled = disableState[(Math.ceil(i/8)-1)]; } } return; } </script> Quote Link to comment Share on other sites More sharing options...
Pavlos1316 Posted June 13, 2008 Author Share Posted June 13, 2008 can anyone here help with this? Quote Link to comment Share on other sites More sharing options...
miracle_potential Posted June 13, 2008 Share Posted June 13, 2008 I'm not a JS programmer but it doesnt look like you have ID's on your check boxes. Really we need to see your whole page or at least the check box section code with it. 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.