Hi-
I have a small problem with the javascript part of a template to template adaptation... I have two forums, when they are submitted they are first checked by some javascript in the code. The problem is that they get mixed up. When I put data into the support form I get a no username error. When I put login info it sends it to support...
Never used javascript before, can just understand what Im looking at but I have no idea how to fix this problem.
I tried making a iframe but Ive never been a fan of them. Plus when I put in an iFram it messes with my sensitive template.
Any help appreciated 🙂
<script language=javascript>
function checklogin() {
if (document.loginform.username.value=='') {
alert("Please enter your username!");
document.loginform.username.focus();
return false;
}
if (document.loginform.password.value=='') {
alert("Please enter your password!");
document.loginform.password.focus();
return false;
}
return true;
}
</script>
<div id="title">
<form method=post name=loginform onsubmit="return checklogin()">
<input type=hidden name=a value='do_login'>
user<input type=text name=username class=inpts size=15>
pass<input type=password name=password class=inpts size=15>
<input type=submit value="Login" class=sbmt size=15>
</div>
<UL>
<div id="content1">
<h3>Support Form:</h3><br>
<script language=javascript>
function checkform() {
if (document.mainform.name.value == '') {
alert("Please type your full name!");
document.mainform.name.focus();
return false;
}
if (document.mainform.email.value == '') {
alert("Please enter your e-mail address!");
document.mainform.email.focus();
return false;
}
if (document.mainform.message.value == '') {
alert("Please type your message!");
document.mainform.message.focus();
return false;
}
return true;
}
</script>
<form method=post name=mainform onsubmit="return checkform()">
<input type=hidden name=a value=support>
<input type=hidden name=action value=send>
<table cellspacing=0 cellpadding=2 border=0>
<tr>
<td>Your Name:</td>
<td><input type="text" name="name" size=30 class=inpts></td>
</tr>
<tr>
<td>Your Email:</td>
<td><input type="text" name="email" size=30 class=inpts></td>
</tr>
<tr>
<td colspan=2>Message:<br><br><textarea name=message class=inpts cols=45 rows=4></textarea>
</tr>
<tr>
<td> </td>
<td><input type=submit value="Send" class=sbmt></td>
</tr></table>
</form>