•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 361,924 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,665 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 1515 | Replies: 2
•
•
Join Date: Mar 2008
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
I am a newbie to javascript and have written the following code to make sure that users have checked a radio button. It is set to work on submit. The form is generated by php and has approx 70 options; users may select one. I am not even sure if the script is being processed because if I test it by submitting without checking a button, the program tries to load the next page without passing a superglobal, and of course I get a php error: "Notice: Undefined index: item in C:\Program Files\EasyPHP 2.0b1\www\dap\subtypemenu.php on line 24".
Is there something obvious in my code that is preventing it from executing? Thanks so much in advance for your help.
Is there something obvious in my code that is preventing it from executing? Thanks so much in advance for your help.
<script language='JavaScript 1.2'>
function submitIt(form)
{
myOption = -1
for (i=0; i<document.prodsearch.item.length; i++)
{
if (document.prodsearch.item[i].checked)
{
myOption = i
}
if (myOption == -1)
{
alert("You must make a selection.")
return false
}
return true
}</script> •
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
- Variable scope problem (C++)
- aurora and drpmon.dll problem (Viruses, Spyware and other Nasties)
- VX2/F problem along with other issues... (Viruses, Spyware and other Nasties)
- IE Hijack Problem (Viruses, Spyware and other Nasties)
- I have a problem with Hotoffers too (Viruses, Spyware and other Nasties)
- Please Help Virus Problem (Viruses, Spyware and other Nasties)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: CSS and XHTML
- Next Thread: FF vs IE dhtml/javascript/forms issue



Threaded Mode