Enter key press opens a new window

Posted on 2006-06-23
Last Modified: 2008-01-09

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??
Question by:gops1
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 30

Expert Comment

ID: 16974071
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>
LVL 17

Author Comment

ID: 16974302
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

Accepted Solution

pradeepsudharsan earned 125 total points
ID: 16974903
     <base target="_self">
add this code in your page
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

LVL 17

Author Comment

ID: 16975158
But I am not redirecting anywhere. Would like to know why this behaviour
LVL 17

Author Comment

ID: 17416559
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.
LVL 30

Expert Comment

ID: 17441714
If you post enough code to allows us to re-create the problem, then there's better change that we can fix it.

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
web page freezes after ajax post 7 100
display data from multiple ajax calls 9 41
Change background images after 5 seconds. 12 46
Woo-commerce gallery not working properly 12 40
I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
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…

734 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