Disable Enter key from submitting form


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 7 of 7

Thread: Disable Enter key from submitting form

  1. #1
    Join Date
    Aug 2004
    Posts
    43,023

    Disable Enter key from submitting form

    [Originally posted by jmig]

    Is there a way using VBScript to keep a form from being submitted when the user presses the enter key? I know you can do it using java script but I would prefer it in vb. Thanks

  2. #2
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Disable Enter key from submitting form

    [Originally posted by Rod]

    This might?? Be of some help.

    http://tinyurl.com/7sbb

  3. #3
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Disable Enter key from submitting form

    [Originally posted by Rod]

    This might?? Be of some help.

    http://tinyurl.com/7sbb

  4. #4
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Disable Enter key from submitting form

    [Originally posted by Sacha Crompton]

    Why do you want it in VB? The only browser that supports VB is Internet Explorer so your site wouldnt work in the other crap browsers that people use.

  5. #5
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Re:Disable Enter key from submitting form

    [Originally posted by jmig]

    Short answer: STUPIDITY.
    Long Answer: I have a project to revamp a company's intranet and then turn it over to their jackass internal developers. All clients use IE so that's not the problem. The majority of scripting has been java. Now about a month into this the IT director insists that all scipting be done in vb because their developers do not know java and apparently won't any time soon. Basically I'm stuck, it looks like a 2 month project's going to last 2 year.
    Welcome to my world!

  6. #6
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Re:Re:Disable Enter key from submitting form

    [Originally posted by m.posseth@work]

    hmmmm

    what you want is not so difficult

    however if you compare it to javascript it perhaps is :-) but that is something else


    VBScript in html pages can work with a funny sort of events ,, if you examine them more closely you wil see that they are in fact CALLBACK routines ! :-)

    this means that every HTML element exposes all of its events to the window object

    so just give your form an ID tag

    #form action="#.htm" id="testform" method="post" target="secHiddenFrame" name="KGEGEVENS"#
    #input type="text" maxlength="30" value="12345"#

    #/form#

    now in the head section of your page


    #head#
    #script language="VBScript"#
    sub testform_onsubmit()
    window.event.returnvalue = false
    end sub
    #/script#
    #/head#


    and cancel this event :-)

    as you see VB script is not so difficult for a vb programmer






  7. #7
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Re:Re:Re:Disable Enter key from submitting form

    [Originally posted by jmig]

    For hours on end I searched the web for this exact item. Thanks for the your time and great info.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center