Hi,
I have a struts form <html:form> in which although the focus rests on
the submit button, hitting the enter key does not submit the form.
I tried capturing the Enter key event and followed it by the
document.form.s ubmit() but this takes me through the validation
attached with the submit twice( giving me all the alerts twice).
Here's the code
function validate()
{
var validateVal = isValidated();//this guy does all the validation
if(!validateVal )
{
return false;
}
else
{
document.CustSe archFormBean.su bmit();
}
}
function checkKeyPressed ()
{
if(window.event .keyCode=="13")
{
validate();
}
}
I call validate
a)for the enter button through <BODY onkeypress=chec kKeyPressed();
b)for the mouseclick submit through <html:submit onclick=validat e();
This may be a whole pointless workaround. Does Struts support
something more elegant?
Any solutions?
Thanks and Regards,
Megha 3 11680
Megha Vishwanath wrote: I have a struts form <html:form> in which although the focus rests on the submit button, hitting the enter key does not submit the form.
I tried capturing the Enter key event and followed it by the document.form.s ubmit() but this takes me through the validation attached with the submit twice( giving me all the alerts twice).
Here's the code function validate() { var validateVal = isValidated();//this guy does all the validation ...
I call validate a)for the enter button through <BODY onkeypress=chec kKeyPressed(); b)for the mouseclick submit through <html:submit onclick=validat e();
Better rely on default form behavior where "enter" does actually submit the
form. Just like that. Try the "onsubmit" on the <form> tag like this:
<form action="?" method="?" onsubmit="retur n isValidated();" >
And make sure that your <html:submit/> renders as <input type="submit"/> in
the real world. One might need to call function isValidated() with an
argument - as in sValidated(this ) - or as a method of the form - like
this.isValidate d(), check it out.
This may be a whole pointless workaround. Does Struts support something more elegant?
Server side validation?
--
Wired Earp
Wunderbyte
I'm sorry , if you attempted to answer my query. I had a problem
completely unrelated to the <html:submit> or the java script function
shown.
I had a numeric lock on one of my fields that was not recognising the
"Enter" event.
Sorry again,
Megha.
I'm sorry , since you attempted to answer my query. I had a problem
completely unrelated to the <html:submit> or the java script function
shown.
I had a numeric lock on one of my fields that was not recognising the
"Enter" event.
Sorry again,
Megha.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: ritelman |
last post by:
Hi I have one text field and one submit button. If I hit the submit
button with a mouse the key/value pair key are properly submitted.
However, if I just hit the enter key the page does get submitted
however without the key/value pair of the submit button. I would
accept that a user must click the button to submit the pair, but none
of my other pages require that. It seems if I just hit the enter key
it defaults to hitting the submit...
|
by: |
last post by:
I have built a login and regsitration system which works wel.
However, one troubling occurs when a user does not click the 'logon' button
but presses 'Enter' on his keyboard....when this happens the logon submit
button is not triggered...does anyone know how to rectify this to cover both
conditions?
Thanks
Jason
|
by: Dennis Allen |
last post by:
Hi. I have a user who wants his form submitted when he presses .
Is it possible? If so, how?
|
by: 23s |
last post by:
My site's login page has a form w/ 2 textboxes and a submit button. If I'm
in either of those textboxes (i.e., either one of the textboxes has focus),
in any given browser, hitting "enter" on my keyboard submits the form.
Server side, I handle the click event of the submit button. This is the
expected behavior, and this is the behavior irrespective of what browser I
use on the login page. However...
I have different page that is an...
|
by: Perry van Kuppeveld |
last post by:
Hi,
I have a problem with formatting a table including text fields wich can
contain up to 255 chars.
I need a table with 3 columns:
- First column 50 % over the with a rowspan of the total number of rows.
- Second column 25 %, no rowspan
- Third column 25 %, no rowspan
| |
by: Alexboy |
last post by:
Hello,
How do I make ENTER key act as a submit request?
As it is now, the user has to actually click "submit" for the form to
be submitted (in IE at least).
Is there any way to make the enter key submit the form?
Example:
|
by: Paul Furman |
last post by:
I'm getting incorrect response when hitting the enter key instead of
actually clicking the button on a form. It activates but the post data
isn't being sent I think. The php generated page
flickers & reloads but doesn't perform the update.
This is php generated, I'm just pasting the page source (reformatted &
extra junk removed and I think they are now identical), and it's running
on my localhost apache server for testing so maybe...
|
by: MichaelK |
last post by:
Who knows how to prevent submitting a form on the press Enter button before
all fields on the form are filled up.
People just enter the first field hit Enter and it submits the form and
doing validation,
of course flushing with the bunch of messages because rest of the fields are
empty.
I remember I had some pages where wrote the code to go on the next field
when pressed the Enter button (Tab like), because it didn't go anywhere at
all....
|
by: Eric D. Braden |
last post by:
I feel like a fool for asking this; seems like I would have had more
luck with Google, but alas...
This is a little baby bit of code that a friend cooked up over a year
ago. My problem is simply that hitting enter doesn't really submit
the input. It just reloads with a cleared form. My desired effect is
for hitting the Enter key to have the same effect as clicking the
Submit button.
Here's the code:
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |