Solved

Enter key press opens a new window

Posted on 2006-06-23
6
478 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
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>
0
 
LVL 17

Author Comment

by:gops1
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
0
 
LVL 7

Accepted Solution

by:
pradeepsudharsan earned 125 total points
ID: 16974903
     <base target="_self">
add this code in your page
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 17

Author Comment

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

Author Comment

by:gops1
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.
0
 
LVL 30

Expert Comment

by:callrs
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.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
removing a class in javascript 4 51
binding event to form in window.open 9 42
Copying table data to one another 15 31
Only allow one check box 17 27
In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
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…

821 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