/    Sign up×
Community /Pin to ProfileBookmark

Kindly help a newbie – Error Message

I have the following code below position in the head and the body of web page. I cannot resolve the error message that appears when I click on the Submit button. I use IE6. Can anyone help me please, I’m a newbie to JavaScript.

Thank you.
Eric

HEAD
<SCRIPT LANGUAGE=”JavaScript”>
<!—
function validinput(FormSignIn)
{
document.write(“This function was executed”);
if ((FormSignIn.txtName.value == “” || FormSignIn.txtName.value == null) || (FormSignIn.txtContact.value == “” || FormSignIn.txtContact.value == null))
{
alert(“Name and Contact No. cannot be empty”);
}
}
//—>

</SCRIPT>

BODY
<form name=”SignIn” method=”POST” action=”BilliardsTourneySignIn.asp”>
<table border=”0″ width=”100%” id=”table8″>
<tr>
<td width=”89″><b><font size=”2″>Name:</font></b></td>
<td width=”158″>
<input type=”text” name=”txtName” size=”25″ style=”font-family: Times New Roman; font-size:
10pt; font-weight: 700″></td>
</tr>
<tr>
<td width=”89″><b><font size=”2″>Contact No.:</font></b></td>
<td width=”158″>
<input type=”text” name=”txtContact” size=”25″ style=”font-family: Times New Roman; font- size: 10pt; font-weight: 700″></td>
</tr>
</table>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;
<input type=”submit” value=”Submit” name=”cmdSubmit” onclick=”validinput(this.form)”></p>
</form>

ERROR MESSAGE: ‘txtName.value’ is null or not an object

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@CrazyMerlinAug 28.2006 — the form is called SignIn...not FormSignIn
Copy linkTweet thisAlerts:
@cootheadAug 28.2006 — Hi there Ciredon,

and a warm welcome to these forums. ?

[b]script[/b]
[color=navy]&lt;script [color=purple]type="text/javascript"[/color]&gt;
&lt;!--
function validinput(FormSignIn) {
if((FormSignIn.txtName.value=="")||(FormSignIn.txtContact.value=="")) {
alert("Name and Contact No. cannot be empty");
[color=purple]return false;[/color]
}
[color=purple]return true;[/color]
}
//--&gt;
&lt;/script&gt;[/color]

[b]form[/b]
[color=navy]&lt;form method="post" action="BilliardsTourneySignIn.asp" [color=purple]onsubmit="[color=green]return[/color] validinput([color=green]this[/color])"[/color]&gt;
...
...
...
&lt;input type="submit" value="Submit"&gt;[/color]

[i]coothead[/i]
Copy linkTweet thisAlerts:
@CrazyMerlinAug 28.2006 — oops, missed the submit name passing...
×

Success!

Help @Ciredon spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...