LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-13-2003, 03:32 PM   #1
Linh
Member
 
Registered: Apr 2003
Posts: 178

Rep: Reputation: 30
Bug in Javascript


When I clicked on the submit button, the alert statement on line number 2 came up as undefined, but on line 34, I had set the value to be "w" as in value=w

34<td align=left border=0 bgcolor=#FE944E width=100%%><input type=radio name=sec_auth value=w size=1>

On line 40, the same radio button is set to "d" as shown below

40<td align=left bgcolor=#FE944E width=100%><input type=radio name=sec_auth value=d size=1>

2 alert (document.form1.sec_auth.value);

on line

4 if (document.form1.sec_auth)
5 alert ("the radio button is highlighted");

The alert did comes up indicating that it did detect the present of a radio button

==============================
Code:
<script LANGUAGE="Javascript">
<!--


function check_if_wg_box_is_blank()
1{
2  alert (document.form1.sec_auth.value);
3
4  if (document.form1.sec_auth)
5    alert ("the radio button is highlighted");
6
7  if (document.form1.sec_auth = "w" && document.form1.wgrp.value == " ")
8    {
9      alert ("the workgroup/domain name field cannot be blank");
10      document.form1.wgrp.focus();
11      document.form1.wgrp.select();
12      return false;
13    }
14  else
15  if (document.form1.sec_auth = "d" && document.form1.lv_pwdsrv.value == " ")
16    {
17      alert ("the domain server name cannot be blank. Default to a *");
18      document.form1.lv_pwdsrv.focus();
19      document.form1.lv_pwdsrv.select();
20      return false;
21    }
22}
23
24
25//-->
26</SCRIPT>

27<table border=0 cellpadding=1 cellspacing=0 align=center bgcolor=#212121 width=99%>
28<form method=post name=form1 onsubmit="return check_if_wg_box_is_blank()" action="<?=$PHP_SELF?>">
29<input type=hidden name=submit value=1>
30<tr>
31
32
33
34<td align=left border=0 bgcolor=#FE944E width=100%%><input type=radio name=sec_auth value=w size=1>
36<font class=black><b>&nbsp;&nbsp;&nbsp;Workgroup</b></font></td>
37
38
39
40<td align=left bgcolor=#FE944E width=100%><input type=radio name=sec_auth value=d size=1>

42<font class=black><b>&nbsp;&nbsp;&nbsp;Windows Domain Server(s)</b></font></td>
43
44<tr><td valign=top><input type=submit name=lb_sec value="Apply Changes to System" class=small></td></tr>
 
Old 10-14-2003, 12:38 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
I may be wrong but I think you need to use:
document.form1.sec_auth.selectIndex.value

If it is a multi value object.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Free86 bug or nVidia bug?? ProtoformX Linux - Software 2 05-12-2004 02:38 AM
javascript in <td>? akaash Programming 0 03-18-2004 12:22 AM
Bug in Javascript Linh Programming 2 09-23-2003 09:45 AM
Bug A Javascript that will not allowed alphabet character type into a text box Linh Programming 2 09-22-2003 11:15 AM
javascript?? Marci Sarwan Programming 1 01-18-2001 09:18 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration