Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: hidden fields


Message #1 by KATHLEEN.M.WHALEN@c... on Mon, 26 Nov 2001 15:25:27 -0500
Well, unfortunately, I was not able to get the syntax for getElementById 
working, but I did come up with an alternate solution.
As always, beware of carriage returns. 

To Imar:  Thanks for the advice.  I need to study up on getElementById 
that's for certain.

Kathleen-
----BEGINNING OF CODE----------
<HTML>
<HEAD>
<META NAME="login" Content="text/html; Microsoft Visual Studio 6.0">
<TITLE>Password Login</TITLE>
<SCRIPT LANGUAGE="JAVASCRIPT">
function Change(){
if (document.frmPassword.change.checked){
Hide1.style.display="inline";
RegPwd.style.display="none";
}
else{
Hide1.style.display="none";
RegPwd.style.display="inline";
document.frmPassword.OldPwd.value="";
document.frmPassword.NewPwd.value="";
document.frmPassword.ConfirmPwd.value="";
}
}
</SCRIPT>
</HEAD>
<BODY>
<h2>Login to Oracle</h2>
<form name="frmPassword" method="post" action="login-practice-2.htm">
<DIV id="UserName" style="display:inline;"><!--will display all the 
time-->
<TABLE BORDER="0" CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH="50%">
        <b>User Name:</b>
</TD>
<TD>
        <input type="text" name="UserID" id="UserName">
</TD>
</TR>
</TABLE>
</DIV>

<DIV id="RegPwd" style="display:inline;"><!--Will display until the option 
to change password is checked-->
<TABLE BORDER="0" CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH="50%">
        <b>Password:</b>
</TD>
<TD>
        <input type="password" name="Pwd" id="Pwd">
</TD>
</TR>
<TR>
<TD colSpan=2 align="center">
        <input type="submit" value="Login">&nbsp;&nbsp;
        <input type="reset" value="Clear Form">
</TD>
</TR>
</TABLE>
</DIV>

<!--Will display only when the option to change password is checked-->
<DIV id="Hide1" style="display:none;"> 
<TABLE BORDER="0" CELLPADDING=2 CELLSPACING=2>
<TR>
<TD WIDTH="50%">
        <b>Old Password:</b>
</TD>
<TD>
        <input type="password" name="OldPwd" id="OldPwd">
</TD>
</TR>

<TR>
<TD>
        <b>New Password:</b>
</TD>
<TD>
        <input type="password" name="NewPwd" id="NewPwd">
</TD>
</TR>
 
<TR>
<TD>
        <b>Confirm Password:</b>
</TD>
<TD>
        <input type="password" name="ConfirmPwd" id="ConfirmPwd">
</TD>
</TR>
<TR>
<TD colSpan=2 align="center">
        <input type="submit" value="Login" id=submit1 
name=submit1>&nbsp;&nbsp;
        <input type="reset" value="Clear Form" id=reset1 name=reset1>
</TD>
</TR>
</TABLE>
</DIV>

<DIV id="txtPrompt" name="TextPrompt" style="display:inline">
<b>Do you wish to Change your password?</b>&nbsp;&nbsp;
<input type="checkbox" name="ChangePassword" id="change" 
onClick="Change();">
(click in the box for yes)
</DIV>

</FORM>
</BODY>
</HTML>
------END OF CODE---------------

=========ORIGINAL MESSAGE===========
I'm designing a really simple form to be used for verifying passwords.  I 
was hoping to be able to use this one page/form to either (1) login or (2) 

change passwords.  So, I set up the form with the following fields: 
UserName, Password, NewPassword and ConfirmPassword.  My hope is to have a 

link on the page to hide/display the fields necessary.  I'm able to 
hide/display the <input> fields, but i'm unable to hide/display the text 
that corresponds with it.  I'm not getting any error messages.  This is 
just not working.

I don't know what I'm doing wrong -- feeling like a fish out of 
water...... -- wishing I had more experience and practice..........

On that same note, is it possible to hide/display entire rows in a table? 
If yes, how?
If anyone has any ideas, I'd be most appreciative.
Here's my code (please don't laugh too hard).  I've included alerts just 
for verification.  It's set up for IE only.

  Return to Index