Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Submit and Reset events failing under graphical replacment buttons

Status
Not open for further replies.

mdclarke

MIS
Nov 3, 2000
9
CA
Hi,

I have made an afternoon's worth of attempts (with help from prior posts here) to get the submit and reset methods to fire for a login form that I have made fancy buttons for.
So far my Object doesn't support this property or method, my forehead is all black and blue and I have a hole in a wall.
Someone please point out what dopey error I'm making.

(Can't find a lot of documentation on the syntax for these things so some of it's a guess).

Thanks


//IMAGE ARRAY
but5 = new Image();
but5.src = "images/SubmitB.gif";
but5h = new Image();
but5h.src = "images/SubmitBH.gif";
but6 = new Image();
but6.src = "images/ResetB.gif";
but6h = new Image();
but6h.src = "images/ResetBH.gif";

//IMAGE SWAP FUNCTION
function changeImage(imgDocID0,imgObjName0)
{
document.images
.src = eval(imgObjName0 + ".src");
}

//Validate the user name and password for presence.

function ValLogin(User,Pass)
{
if (User == "")
{
alert("Please Enter A User Name");
LoginF.UserID.focus();
return false;
}
else if (Pass == "")
{
alert("Please Enter A Password");
LoginF.Password.focus();
return false;
}
else
{
document.LoginF.submit();
return true;
}

}

<form NAME=&quot;LoginF&quot; ACTION=&quot;LoginVal.ASP&quot; METHOD=&quot;POST&quot;>
<table CELLPADDING=&quot;0&quot; CELLSPACING=&quot;10&quot; BGCOLOR=&quot;#003366&quot;>
<tr>
<td COLSPAN=&quot;2&quot; ALIGN=&quot;center&quot; BGCOLOR=&quot;#003366&quot;>
<h2><font face=&quot;Arial, Verdana&quot; color=&quot;#FFFFFF&quot;>Login</font></h2>
</td>
</tr>
<tr>
<td>
<p><b><font face=&quot;Arial, Verdana&quot; color=&quot;#FFFFFF&quot;>User
Name</font><font FACE=&quot;Arial, Verdana&quot;>:</font></b></td>
<font FACE=&quot;Arial, Verdana&quot; COLOR=&quot;#660066&quot;>
<td><input TYPE=&quot;text&quot; SIZE=&quot;20&quot; Name=&quot;UserID&quot;></td></font>
</tr>
<tr>
<td><b><font face=&quot;Arial, Verdana&quot; color=&quot;#FFFFFF&quot;>Password:</font></b></td>
<font FACE=&quot;Arial, Verdana&quot; COLOR=&quot;#660066&quot;>
<td><input TYPE=&quot;Password&quot; SIZE=&quot;20&quot; Name=&quot;Password&quot;></td></font>
</tr>
<tr>
<td><a href=&quot;#&quot; onClick=&quot;return ValLogin(document.LoginF.UserID.value,document.LoginF.Password.value)&quot; onmouseover=&quot;changeImage('submit','but5h')&quot; onmouseout=&quot;changeImage('submit','but5')&quot;><IMG src=&quot;images/SubmitB.gif&quot; width=&quot;60&quot; height=&quot;30&quot;border=&quot;0&quot; name=&quot;submit&quot; alt=&quot;Submit Login&quot;></a></td>
<td><a href=&quot;#&quot; onclick=&quot;document.LoginF.reset()&quot; onmouseover=&quot;changeImage('reset','but6h')&quot; onmouseout=&quot;changeImage('reset','but6')&quot;><IMG src=&quot;images/ResetB.gif&quot; width=&quot;60&quot; height=&quot;30&quot;border=&quot;0&quot; name=&quot;reset&quot; alt=&quot;Reset Login&quot;></a></td> </tr>
</table>
</form>
 
I think your error is here:

Code:
<a href=&quot;#&quot; onClick=&quot;return ValLogin(document.LoginF.UserID.value,document.LoginF.Password.value)&quot; onmouseover=&quot;changeImage('submit','but5h')&quot; onmouseout=&quot;changeImage('submit','but5')&quot;>

You didn't put single quotes around the names of the fields. The code should look like this:

Code:
<a href=&quot;#&quot; onClick=&quot;return ValLogin([b]'document.LoginF.UserID.value','document.LoginF.Password.value'[/b])&quot; onmouseover=&quot;changeImage('submit','but5h')&quot; onmouseout=&quot;changeImage('submit','but5')&quot;>

Hope that helps!

Happy coding! :)
 
Ignore the
Code:
[b][/b]
tags in the revision of the code. I didn't realize you couldn't put &quot;TGML&quot; within the code tags.
 
Hi,

Thanks

The userid/password validation functions well, it's when it gets to the document.LoginF.submit;() or .reset() that it dies.


ps. the single quotes failed.



MDC
 
hi

I have hacked most of the code away in the hope that something was lurking in there, no luck.

It's serving at untill I drop my connection (joys of dynamic I.P.s)

MDC
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top