Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


firasassaad106@hotmail.com

 
Logged in as: Guest
arrSession:exec spGetSession 2,3,2359
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> ASP >> firasassaad106@hotmail.com
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 firasassaad106@hotmail.com - 3/15/2005 11:08:08 PM   
  pnjaisan@yahoo.com

 

Posts: 9
Score: 0
Joined: 3/15/2005
From: India
Status: offline
Hello sir,

I'm trying to set the foucs while validation checking.

i have two textbox and one submit button.
Name:
age :

The Age Textbox, have a one validation is only accept above 18 and below 60. this validation always working fine.

My problem is, the input values is not valid, the setfoucs method not working.

hlp me..

thanking you,
N.Jai Sankar,
pnjaisan@yahoo.com
 
 
Post #: 1
 
 Re: firasassaad106@hotmail.com - 3/16/2005 3:11:14 AM   
  VBS

 

Posts: 110
Score: 0
Joined: 3/2/2005
From: Lebanon
Status: offline
Dear pnjaisan@yahoo.com,
I just want to make sure that i had understanded u:
You mean that you want to set the focus on the Age TextBox when the input values is not valid??

If yes then use the code bellow, if not post another reply where i could understand u better or email me on firasassaad106@hotmail.com or firas488@yahoo.com:

<!--Start Code-->
<%@ Language=VBScript %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>

<form method="get" action="1.asp" name=form1> <!--Same Page-->
<font color=Black size=4>Name: <INPUT type="text" name=txtName></font><br>
<font color=Black size=4>Age: <INPUT type="text" name=txtAge></font><br>
<INPUT type="hidden" name=cmd value=1>
<INPUT type="submit" value="Submit" id=submit1 name=submit1>
</form>

<%
if Request.QueryString("cmd")=1 then
if Request.QueryString("txtAge")<"18" or Request.QueryString("txtAge")>"60" then
Response.Write "no"%>
<script language="VBSCRIPT">
document.form1.txtAge.focus()
</script><%
end if
end if
%>

</BODY>
</HTML>
<!--End Code-->

Hope it works, and don't forget to tell me the results

(in reply to pnjaisan@yahoo.com)
 
 
Post #: 2
 
 Re: firasassaad106@hotmail.com - 3/16/2005 4:03:48 PM   
  pnjaisan@yahoo.com

 

Posts: 9
Score: 0
Joined: 3/15/2005
From: India
Status: offline
Hello sir,

I'm very appreciate ur imme. ans.. i hope to work fine your answer.

i'm writting the script using HTML and VBScript .. like this

<!-- Start -->
<HTML>
<HEAD>
<SCRIPT TYPE=TEXT/VBBSCRIPT>
FUNTION CHECKING(X)
IF (X.VALUE<15 OR X.VALUE>60) THEN
ALERT("Invalid age ...! Try Again")
X.SETFOCUS()
EXIT FUNCTION
END IF
END FUNCTION
</SCRIPT>
</HEAD>
<BODY>
<form>
Name: <INPUT type="text" name=txtName><br>
Age: <INPUT type="text" name=txtAge onBlur=Checking"(name)"><br>
<INPUT type="submit" value="Submit" name=submit>
</form>

</BODY>
</HTML>
<!-- end -->

the above script working fine .. but if give invalid age, the focus not set in the age textbox ...

any solution this same code with out using asp ...

Thankx.

Sir what is ur email-id...?

Jai Sankar, N,

(in reply to pnjaisan@yahoo.com)
 
 
Post #: 3
 
 Re: firasassaad106@hotmail.com - 3/16/2005 4:57:58 PM   
  VBS

 

Posts: 110
Score: 0
Joined: 3/2/2005
From: Lebanon
Status: offline
Dear pnjaisan,
If that is what u mean then use the code below and sorry for not understanding u correctly

<!-- Start -->
<HTML>
<HEAD>
<script language="VBSCRIPT">
sub Check()
if document.form1.txtAge.value<15 or document.form1.txtAge.value>60 then
ALERT("Invalid age ...! Try Again")
document.form1.txtAge.focus
end if
end sub
</SCRIPT>
</HEAD>
<BODY>
<form name="form1">
Name: <INPUT type="text" name=txtName><br>
Age: <INPUT type="text" name=txtAge onBlur="VBSCRIPT:Check"><br>
<INPUT type="submit" value="Submit" name=submit>
</form>

</BODY>
</HTML>
<!-- end -->

Please note that the code does exactly the same as u want, but i changed few things to make it work


Best Regards

Firas S Assaad

(in reply to pnjaisan@yahoo.com)
 
 
Post #: 4
 
 Re: firasassaad106@hotmail.com - 3/16/2005 5:21:31 PM   
  pnjaisan@yahoo.com

 

Posts: 9
Score: 0
Joined: 3/15/2005
From: India
Status: offline
Hi Sir,

Your code, wroking fine ...and i'm appreciate your immediate response me..

Sir, u mention ......onBlur="VBSCRIPT:Check>, in this line the VBSCRIPT represent to what ? this word is compulsory or not..

Moreover, i want to use function instead of sub procedure, how to modify it?

What i mean, i passing the anyone of control name and get it, then checking condition...like as accept number only, or age checking ...

Could u please ...

Thankx your, kind answer ..
N.Jai Sankar
Chennai.

(in reply to pnjaisan@yahoo.com)
 
 
Post #: 5
 
 Re: firasassaad106@hotmail.com - 3/16/2005 6:16:37 PM   
  VBS

 

Posts: 110
Score: 0
Joined: 3/2/2005
From: Lebanon
Status: offline
Dear pnjaisan,
The VBSCRIPT is a command to run the VBScript code, so that it will not conflict with JavaScript (if you have any),

And accurding to the Sub and Function, take my advice use Sub Procedures cause they r better in a situation like this..

But if insist on using the Function, Here is the code

<!-- Start -->
<HTML>
<HEAD>
<script language="VBSCRIPT">
FUNCTION CHECKING(X)
IF (X.VALUE<15 OR X.VALUE>60) THEN
ALERT("Invalid age ...! Try Again")
document.form1.txtAge.focus
EXIT FUNCTION
END IF
END FUNCTION

</SCRIPT>
</HEAD>
<BODY>
<form name="form1">
Name: <INPUT type="text" name=txtName><br>
Age: <INPUT type="text" name=txtAge onBlur=Checking(txtAge)><br>
<INPUT type="submit" value="Submit" name=submit>
</form>

</BODY>
</HTML>
<!-- end -->

please note that this code works fine and i removed the VBSCRIPT and used the FUNCTION

Best Regards

Firas S Assaad

(in reply to pnjaisan@yahoo.com)
 
 
Post #: 6
 
 Re: firasassaad106@hotmail.com - 3/16/2005 6:57:24 PM   
  pnjaisan@yahoo.com

 

Posts: 9
Score: 0
Joined: 3/15/2005
From: India
Status: offline
Hello sir,

Thanking you, for your kind advice ...

and

keep touch with me ..

N.Jais

(in reply to pnjaisan@yahoo.com)
 
 
Post #: 7
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> ASP >> firasassaad106@hotmail.com Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts