Re: PhP and Java login trouble
| From: | Chris | Date: | Wed, 09 May 2007 06:16:19 +0000 |
| Subject: | Re: PhP and Java login trouble | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-254629@lists.php.net to get a copy of this message | ||
Brad Sumrall wrote:
I have been hunting all around that website you referred me too looking for javascripting information and can find nothing. I know a little bit of php but little to nothing about javascripting.Eh? I never sent you to a website. See this code: function validatelogin() { if(document.frmlogin.txtusername.value=="") { alert("Please Enter Username."); document.frmlogin.txtusername.focus(); return false; } if(document.frmlogin.txtpwd.value=="") { alert("Please Enter Password."); document.frmlogin.txtpwd.focus(); return false; } document.frmlogin.login.value="Success"; document.frmlogin.action="operation.php?mode=login"; return true; } You need to create a *similar* function (eg 'BBValidateLogin()') to check different html field names. For example: function BBValidateLogin() { var f = document.forms[0]; alert('username is ' + f.username.value); } The username.value comes from this: <input type="text" class="post" name="username" size="25" maxlength="40" value="" /> where you have name="username" So take the name="..." and put a .value on the end. Rinse, repeat until you have checked all of the fields you need to. Return true for the form to submit. Return false for it to NOT submit. -- Postgresql & php tutorials http://www.designmagick.com/