You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Pat Ryan <pr...@cardean.edu> on 2002/09/17 21:25:37 UTC

ActionEvent / eventSubmit_doStuff and the Enter Key

Hi,

We are trying to use ActionEvents in our Jetspeed app.  We are setting
the form action to be an action class that has a doLeroycheck method
(don't ask! ;-).  The problem is that, if we submit the form by clicking
the submit button, the doLeroycheck is called, but if the cursor is in
the text field and the Enter Key is pressed, the doLeroycheck is not
called, but the buildNormalContext (the normal Jetspeed Portlet call) is
called.  Anybody know if this an IE problem?  Turbine problem?  Or our
problem (easiest to fix!)?

<form action="$link.setAction("portlets.LeroyAction")" method=POST>
    ## Load the intake group for this form
    #set ($leroyGroup = $intake.get("LeroyGroup").Default)
    #if ( !$leroyGroup.Username.isValid() )
        Data Validation Failed: $leroyGroup.Username.Message<br>
    #end

    ## Print the input field with prior data if any
    enter a name:<input value="$!leroyGroup.Username"
name="$leroyGroup.Username.Key" maxlength="25" type="text"><br>

    ## Print the submit button with ActionEvent
    <input type="submit" name="eventSubmit_doLeroycheck" value="Do Leroy
Check">

    ## Declare Intake Group (required)
    $intake.newForm()
    $intake.declareGroup($leroyGroup)
</form>

--Pat



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: ActionEvent / eventSubmit_doStuff and the Enter Key

Posted by Scott Eade <se...@backstagetech.com.au>.
> From: "Chris K Chew" <ch...@fenetics.com>
> 
> Most browsers simply send the header "submit: true" when the enter key is
> pressed and the cursor is in a form field.  As such, ActionEvents won't work
> when this happens because they rely on the submit field's name to determine
> which ActionEvent to call.  In your app, the enter-submitted header contains
> the standard "submit" instead of "evenSubmit_doLeroyCheck".

If it works this way and your action class does not use doPerform() for
anything else then you could change doPerform to invoke doLeroycheck() to
cover this possibility.

Cheers,

Scott
-- 
Scott Eade
Backstage Technologies Pty. Ltd.
http://www.backstagetech.com.au



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: ActionEvent / eventSubmit_doStuff and the Enter Key

Posted by Chris K Chew <ch...@fenetics.com>.
Most browsers simply send the header "submit: true" when the enter key is
pressed and the cursor is in a form field.  As such, ActionEvents won't work
when this happens because they rely on the submit field's name to determine
which ActionEvent to call.  In your app, the enter-submitted header contains
the standard "submit" instead of "evenSubmit_doLeroyCheck".

The best thing to do would be to capture the keypress event and filter out
the enter key to disable that functionality.  If you prefer to keep the
functionality, you must have the event "click" the correct submit button for
you when the keycode equals the enter-keycode.  Google for capturing the
onkeypress event for info on how to do capture key presses.  You should also
try using a packet sniffer to see more clearly what I am talking about (I
like IRIS in windows).

Chris

-----Original Message-----
From: Pat Ryan [mailto:pryan@cardean.edu]
Sent: Tuesday, September 17, 2002 1:26 PM
To: Turbine Users List
Subject: ActionEvent / eventSubmit_doStuff and the Enter Key



Hi,

We are trying to use ActionEvents in our Jetspeed app.  We are setting
the form action to be an action class that has a doLeroycheck method
(don't ask! ;-).  The problem is that, if we submit the form by clicking
the submit button, the doLeroycheck is called, but if the cursor is in
the text field and the Enter Key is pressed, the doLeroycheck is not
called, but the buildNormalContext (the normal Jetspeed Portlet call) is
called.  Anybody know if this an IE problem?  Turbine problem?  Or our
problem (easiest to fix!)?

<form action="$link.setAction("portlets.LeroyAction")" method=POST>
    ## Load the intake group for this form
    #set ($leroyGroup = $intake.get("LeroyGroup").Default)
    #if ( !$leroyGroup.Username.isValid() )
        Data Validation Failed: $leroyGroup.Username.Message<br>
    #end

    ## Print the input field with prior data if any
    enter a name:<input value="$!leroyGroup.Username"
name="$leroyGroup.Username.Key" maxlength="25" type="text"><br>

    ## Print the submit button with ActionEvent
    <input type="submit" name="eventSubmit_doLeroycheck" value="Do Leroy
Check">

    ## Declare Intake Group (required)
    $intake.newForm()
    $intake.declareGroup($leroyGroup)
</form>

--Pat



--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>