Results 1 to 5 of 5

Thread: VB Script in ASP

  1. #1

    Thread Starter
    Addicted Member Codehammer's Avatar
    Join Date
    Aug 2004
    Posts
    164

    Question VB Script in ASP

    VB Code:
    1. Response.Write("Your Cellphone Number:<input type='textbox' onblue='validateTelephone' name='oCELLPHONE'/><br>")

    I Have the Following VB Script Code:
    VB Code:
    1. Sub validateTelephone()
    2.   if mid(document.frmCustomerDetails.txtTelephone.value,1,1) <>"(" then
    3.      MsgBox "The Telephone Number must be in the Form: (000)000-0000",8,"Error"
    4.      
    5.         elseif mid(document.frmCustomerDetails.txtTelephone.value,9,1) <>"-" then
    6.      MsgBox "The Telephone Number must be in the Form: (000)000-0000",8,"Error"
    7. end if
    8. 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

  2. #2
    Fanatic Member kaihirst's Avatar
    Join Date
    Jul 2005
    Location
    The Resaurant At the End of The Universe
    Posts
    633

    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

    VB Code:
    1. <%
    2.  
    3. code
    4.  
    5. %>

    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


  3. #3

    Thread Starter
    Addicted Member Codehammer's Avatar
    Join Date
    Aug 2004
    Posts
    164

    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

  4. #4
    Hyperactive Member kayos's Avatar
    Join Date
    Apr 2004
    Location
    Largo, Florida
    Posts
    306

    Re: VB Script in ASP

    Quote 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

  5. #5

    Thread Starter
    Addicted Member Codehammer's Avatar
    Join Date
    Aug 2004
    Posts
    164

    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
  •  



Click Here to Expand Forum to Full Width