Solved

Enter key press opens a new window

Posted on 2006-06-23
6
468 Views
Last Modified: 2008-01-09
Hi

I found a strange behaviour for input boxes inside a modal window. I am opening a popup using modal window. Inside this window I have input boxes. For this boxes I have written special chars validations on keypress. But when I press ENTER key it does not validate but opens the same file inside a new window. Is it a bug??
0
Comment
Question by:gops1
  • 3
  • 2
6 Comments
 
LVL 30

Expert Comment

by:callrs
Comment Utility
Say your validation function is called "Form_Validator". Then put this statement in your form tag:
onsubmit="return Form_Validator(this)"

Here's an example from someone's site:
<form action="../_vti_bin/shtml.dll/modulo.htm" method="POST" name="FrontPage_Form1" language="JavaScript" onsubmit="return FrontPage_Form1_Validator(this)">

-------
Now, in your validation function, return false to not submit the form (e.g. if user has made an error), or true to submit the form (if user input is OK).

---
Make sure your input boxes are enclosed in  these tags: <form onsubmit=...> ... </form>
0
 
LVL 17

Author Comment

by:gops1
Comment Utility
This happens only when I call the page inside a ModalWindow. Just to check I created a sample modal window with a input box and there too it behaves the same
0
 
LVL 7

Accepted Solution

by:
pradeepsudharsan earned 125 total points
Comment Utility
     <base target="_self">
add this code in your page
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 17

Author Comment

by:gops1
Comment Utility
But I am not redirecting anywhere. Would like to know why this behaviour
0
 
LVL 17

Author Comment

by:gops1
Comment Utility
Since I could not get what I expected, I am closing this query. But anyways thanks a lot for the effort you all have put to help me out.
0
 
LVL 30

Expert Comment

by:callrs
Comment Utility
If you post enough code to allows us to re-create the problem, then there's better change that we can fix it.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now