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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

2 onClick actions?

Status
Not open for further replies.

wuzzle

Programmer
Dec 20, 2000
75
0
0
CA
I want both these functions to run when they submit their password:

function formValidation(PasswordForm)
{
//txtPassword=document.PasswordForm.txtPassword;

with (PasswordForm)
{
if (txtPassword.value.length < 6)
{
alert('Your password must be at least 6 characters long.')
}
if (txtConfirmPassword.value.length < 6)
{
alert('Your confirmation password must be at least 6 characters long.')
}
}
}

function EditPassword()
{
//This Function will check the validity of the text in txtCompanyName
//If it's valid, then it will pass the name to basEditCompanyName.asp
var strPassword;

strPassword = document.form3.txtPassword.value;
location=&quot;basEditCompanyName.asp?strName=&quot; + strCompanyName;

}

How do I set the onClick in the button to carry out 2 different things at once?
 
Can I combine them somehow to make it check the length of the password, and if it's over 6 characters, the rest will follow through?
 
Try adding both function calls like onClick=&quot;JAVASCRIPT:fnOne();fnTwo();&quot;
 
Hey cool! It worked.

Why would it be saying &quot;document.form3.txtPassword.value; is not an object? What do I need to do?
 
Call EditPassword()from formValidation() if the data is vilid.

Hope this helps. Nice one :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top