Old 02-09-2010, 05:26 AM   #1
ims225
Registered User
Afrostyle Validating text box

Hi,
i'm jus trying to validate my text box with the given given user name and password... i hav jus predefined the values for username and password... help me how to validate it...
ims225 is offline   Reply With Quote

Sponsored Links (Guests Only) - Register | Need Help?

Old 02-09-2010, 11:43 AM   #2
actionAction
humanBeing._beard=true;
 
actionAction's Avatar
This isn't enough information to go on, what server side language are you using, what is the name of your text box?

__________________
there are two types of people in the world - those who understand recursion and there is one type of person in the world
actionAction is offline   Reply With Quote
Old 02-10-2010, 12:22 AM   #3
ims225
Registered User
OK i'l elaborate my question... i'm using java script for validation n the name of the function is validate() below is the coding for that
function validate()
{
var txt1 = document.getElementsByName('username');
var txt2 = document.getElementByName('pass');
var hasChecked = false;
if (txt1 == betting && txt2 == bet1234)
{
hasChecked = true;
break;
}
if (hasChecked == false)
{
alert("Invalid User Name and Password");
return false;
}
return true;
}
</script>

and my form is as follows
<form name="form1" onSubmit="return_validate()" action="admin.asp" >
<tr>
<td width="90" align="right"><span class="Estilo8">User Name: </span></td>
<td width="131"><div align="right">
<input type="text" name="username" size="16" >
</div></td>
</tr>
<tr>
<td align="right"><span class="Estilo8">Password: </span></td>
<td><div align="right">
<input name="pass" type="password" size="16">
</div></td> </tr>
<tr>

<td></td><td><div align="right">

<input type="submit" value="submit" name="submit">


my question how can i validate this with the given user name and pasword and should have to move to the next page... pl help
ims225 is offline   Reply With Quote
Old 02-10-2010, 12:32 AM   #4
actionAction
humanBeing._beard=true;
 
actionAction's Avatar
change "return_validate()" to "return validate()"

The space is important.

__________________
there are two types of people in the world - those who understand recursion and there is one type of person in the world
actionAction is offline   Reply With Quote
Old 02-10-2010, 03:22 AM   #5
ims225
Registered User
that is not working buddy.... can u give me any hard code for this login page.. i'm jus trying to get result for this.. pl help...
ims225 is offline   Reply With Quote
Old 02-10-2010, 08:44 AM   #6
simplistik
PseudoMex
 
simplistik's Avatar
Location Tallahassee, FL

Posts 10,112
  1. it's getElementsByName not getElementByName
  2. you need to enclose the comparison values of txt1 and txt2 in quotes
  3. your if statement for hasChecked is improperly done, you don't have an else condition defined
  4. your function is not properly closed
  5. this is not a Server Side question it's a Client Side question so I'm moving it

__________________
Let us live so that when we come to die even the undertaker will be sorry. - Mark Twain
Don't PM me your CSS, xHTML, JS or PHP questions. I will not reply to ANY IE6 questions.
simplistik is offline   Reply With Quote
Old 02-11-2010, 11:24 AM   #7
bassmansg
Registered User
 
bassmansg's Avatar
You know anyone will be able to view your page source and see the correct username and password right?

__________________
<!--0.o--> don't tell the elf
bassmansg is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:32 PM.

SHARE:

SUPPORTERS:

cdn
content delivery network (cdn)

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd. Copyright 2010 - kirupa.com Copyright 2010 - kirupa.com