|
-
Dec 7th, 2005, 06:57 AM
#1
Thread Starter
Addicted Member
VB Script in ASP
VB Code:
Response.Write("Your Cellphone Number:<input type='textbox' onblue='validateTelephone' name='oCELLPHONE'/><br>")
I Have the Following VB Script Code:
VB Code:
Sub validateTelephone()
if mid(document.frmCustomerDetails.txtTelephone.value,1,1) <>"(" then
MsgBox "The Telephone Number must be in the Form: (000)000-0000",8,"Error"
elseif mid(document.frmCustomerDetails.txtTelephone.value,9,1) <>"-" then
MsgBox "The Telephone Number must be in the Form: (000)000-0000",8,"Error"
end if
end sub
I Dont know where to Put This, I Tried in the Body which Gave Errors, Then I Tried in the Head in its own [script] ,[/script] and then it worked but the following error for document.frmCustomerDetails.txtTelephone.
I Know is Suppose to be request.form(oCELLPHONE) instead of document.frmCustomerDetails.txtTelephone but that doesnt Work. That is Why I Posted the Vb Code Fully.
Where is this thing Wrong? Onblur is used, then thats maybe why request is getting the error since I think request is only for Posts or Not?
Thanks
Curiosity SKILLED the cat
Google Talk from your Mobile phone
Chat from your mobile or get an emulator like J2ME Wireless Toolkit 2.2
-
Dec 7th, 2005, 08:25 AM
#2
Fanatic Member
Re: VB Script in ASP
Hi,
General tip for you.
All script that needs to be pre-loaded befor eth epage for controls and such , go above the document header, at line 1, therefore theyll load before your apge controls will, giving better response time.
and put it between
This will parse it as server side code.
ta
Kai
As the information I give is useful in its nature, consider using the RATE POST feature located on the bottom left of this post please..
A few things that make a good Developer a Great One.
Methodical and a thorough approach to research and design inevitably leads to success.
Forward thinking is the key to Flow of control.
Never test in the design environment, always test in real time, you get the REAL results.
CBSE & OOSE are the same animal, they just require different techniques, and thinking.
SEO is a globe of objectives, SE rankings is an end to a means for these objectives, not part of them.
The key to good design is explicit attention to both detail and response.
Think Freely out of the "Box" you're in..... You will soar to better heights.
Kai Hirst - MSCE, MCDBA, MCSD, MCP, MCAP, MSCT
-
Dec 7th, 2005, 08:48 AM
#3
Thread Starter
Addicted Member
Re: VB Script in ASP
That where the code is and the % stuff is in. the validation wont work because of something in document.frmCustomerDetails.txtTelephone.value
Any Idea?
Curiosity SKILLED the cat
Google Talk from your Mobile phone
Chat from your mobile or get an emulator like J2ME Wireless Toolkit 2.2
-
Dec 8th, 2005, 04:59 PM
#4
Hyperactive Member
Re: VB Script in ASP
 Originally Posted by Codehammer
That where the code is and the % stuff is in. the validation wont work because of something in document.frmCustomerDetails.txtTelephone.value
Any Idea?
VBScript is not like VB. you need to use the "Request" object to grab your information. try using Request.Form("txtTelephone") <- in place of what you have to retrieve the telephone there.
If this post helps, please RATE MY POST!
Using Visual Studio 2005 SE
-
Dec 12th, 2005, 03:50 AM
#5
Thread Starter
Addicted Member
Re: VB Script in ASP
Here's What is Suppose to Happen, I have a Aspx page with a textbox called OCellphone. When the focus is lost for this the sub validatetelephone is called. the code was originally for vbscript which worked 100%. I basically need a conversion for aspx as the error that occurs: "document.frmCustomerDetails.txtTelephone.value"
I know its suppose to be Request.Form("OCellphone") but that does not work, which is why I psoed the Code. Could Someone please test it to see why its doesnt seem to ID the textbox Ocellphone.
Curiosity SKILLED the cat
Google Talk from your Mobile phone
Chat from your mobile or get an emulator like J2ME Wireless Toolkit 2.2
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|