Re: PhP and Java login trouble

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux