Hey, I was wondering if there was some simple way of checking if two (or more, which there will be when I start doing other forms) input forms are filled with something?
For example, if there is a form called "input" and two text fields called name and password is there anyway I can check if they have stuff in them? I tried this code below, but I can't see to get it working. :S
So that doesn't seem to be working. And I apologize, but I don't know much about Javascript, so I must learn some. Thank you, and kind regards.
For example, if there is a form called "input" and two text fields called name and password is there anyway I can check if they have stuff in them? I tried this code below, but I can't see to get it working. :S
| Code: |
| <script language="javascript" type="text/javascript">
function submitbutton_reg() { var form = document.loginbox; // do field validation if (form.username.value == "") { alert( "Please enter your name." ); } else if (form.password.value == "") { alert( "Please enter a User name." ); } else { form.submit(); } } </script> <h1>Login</h1> <div class="content"> <form action="login.php?page=login" method="post" name="loginbox"> Username: <input type="text" name="username" size="32" maxlength="15" class="text" value=""> Password:<input type="password" name="password" size="32" maxlength="32" value=""> <input type="button" value="Login" class="button" onclick="submitbutton_reg()"> |
So that doesn't seem to be working. And I apologize, but I don't know much about Javascript, so I must learn some. Thank you, and kind regards.
