struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Frank Zammetti" <fzamm...@hotmail.com>
Subject RE: More than one submit buttons
Date Tue, 01 Jun 2004 18:07:05 GMT
Unfortunately I'm just starting to play with JSTL myself, so I can't give 
you any help there.

Here's a complete example of both things... I even tested it, and it does 
work (although come to think of it, I'm not 100% sure it'll work in anything 
besides IE, I'll leave that to you to find out... I think it should 
though)...

<html><head><title></title></head><body>
<form name="theForm" method="post" action="whatever.app">
  <input type="text" name="field1" 
onKeyPress="if(window.event.keyCode==13){theForm.submit();}">
  <br>
  <select name="field2" 
onKeyPress="if(window.event.keyCode==13){theForm.submit();}">
    <option value="opt1">opt1</option>
  </select>
  <br>
  <input type="button" name="ignoreKeypress" value="No Enter Here!" 
onKeyPress="if(window.event.keyCode==13){return false};">
  <br>
  <input type="submit" value="Submit">
</form>
</body></html>

Hope that helps!

Frank

>From: "Voinea, Marina" <Marina.Voinea@genesys.com>
>Reply-To: "Struts Users Mailing List" <user@struts.apache.org>
>To: "Struts Users Mailing List" <user@struts.apache.org>
>Subject: RE: More than one submit buttons
>Date: Tue, 1 Jun 2004 13:34:51 -0400
>
>
>Thank you very much, Frank, we'll use your idea.
>
>we also need to do what you've done : your "reverse behaviour:submit the 
>form when any of the fields has focus rather than just the submit button" .
>
>Because I'm not that experienced with java script, could please forward an 
>example from your code (before I try it for one day to make it work...).
>   (event handler attached to the button or to the field ...)
>  Do you have any JSTL that would do that ? ( we try to minimize java 
>script as much as possible).
>
>  We appreciate your help greatly!
>Marina
>
>-----Original Message-----
>From: Frank Zammetti [mailto:fzammett@hotmail.com]
>Sent: Tuesday, June 01, 2004 12:23 PM
>To: user@struts.apache.org
>Subject: RE: More than one submit buttons
>
>
>I've never tried this, but I've done the reverse, so it probably should
>work... you should be able to just eat the enter key event via client-side
>scripting.  This SHOULD work:
>
>if (window.event.keyCode == 13) { return false; }
>
>Attach that as a page-level event handler and I think it'll do the trick.
>You may have to attach it to each of the submit buttons (in fact, that 
>might
>be required INSTEAD of making it page-level, I think that might be the
>case).
>
>As I said, I've done the exact reverse, handling enter as a submit event 
>(so
>that you could submit the form when any of the fields has focus rather than
>just the submit button), so I'd bet this works.
>
> >From: "Kamholz, Keith   (corp-staff) USX" <kkamholz@moog.com>
> >Reply-To: "Struts Users Mailing List" <user@struts.apache.org>
> >To: 'Struts Users Mailing List' <user@struts.apache.org>
> >Subject: RE: More than one submit buttons
> >Date: Tue, 1 Jun 2004 11:48:48 -0400
> >
> >I have a similar but different problem.  I'm using multiple submit 
>buttons
> >on a form, using the Lookup Dispatch Action.  Are you using that too?
> >Anyway, when I click on a button, it works just fine.  However, when the
> >enter button is pressed, I get an error.  It probably doesn't know which
> >method to use since I didn't actually a button.  How do you (or anyone
> >else)
> >deal with this issue?
> >
> >
> >- Keith
> >
> >
> >
> >-----Original Message-----
> >From: Voinea, Marina [mailto:Marina.Voinea@genesys.com]
> >Sent: Monday, May 31, 2004 11:49 AM
> >To: Struts Users Mailing List
> >Subject: RE: More than one submit buttons
> >
> >
> >Regariding the same issue : multiple submit buttons on a form :
> >   We've implemented this succsefully, however, there is still an issue ,
> >does anybody have an idea what would be the best and simplest way to deal
> >with it?
> >
> >
> >   The problem is as following :
> >     A form gets submitted not only through a submit button, but also by
> >entering "CR" (enter, carriage return...).
> >    The thing is that, in that case, the first button on the form seems 
>to
> >get submitted, and  I get , in my request , the parameter associated with
> >the first button on the form, which is wrong.
> >   (The action checks for that parameter and finds that the button has 
>been
> >submitted, which is wrong....).
> >    I would like to stop the form from being submitted on "enter" for 
>ex...
> >
> >   What would be the best way to solve this issue? How do you guys 
>usually
> >do
> >it (and still using STruts multiple buttons on the same form...)
> >
> >Thank you very mch.....
> >Marina
> >
> >
> >-----Original Message-----
> >From: praveen kulkarni [mailto:job4pak@yahoo.co.in]
> >Sent: Monday, May 31, 2004 1:28 AM
> >To: user@struts.apache.org
> >Subject: Re:More than one submit buttons
> >
> >
> >Hi Kalla,
> >
> >To use more than one submit buttons, in struts, u can use
> >DispatchAction which is a subclass of Action.
> >
> >By configuring the action in Struts-config, u can add "parameter"
> >attribute as "submit".
> >
> >And no need of writing n number of Action classes for n submit
> >buttons!!!
> >
> >u can write it as buttonAAction(......) instead of execute(...) func
> >
> >Bye
> >PAK
> >
> >Yahoo! India Matrimony: Find your partner online.
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >For additional commands, e-mail: user-help@struts.apache.org
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >For additional commands, e-mail: user-help@struts.apache.org
> >
>
>_________________________________________________________________
>Get 200+ ad-free, high-fidelity stations and LIVE Major League Baseball
>Gameday Audio! http://radio.msn.click-url.com/go/onm00200491ave/direct/01/
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>

_________________________________________________________________
Express yourself with the new version of MSN Messenger! Download today - 
it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message