You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by David Demner <tu...@demner.com> on 2004/03/26 19:44:42 UTC

Form submittal problem

I'm trying to get around a form submittal problem.  I have a very simple
form (1 text box and 1 submit button named eventsubmit_doWhatever) where
method="post" and action="$link.setAction("MyAction")".
 
When the user clicks on the button, the submit button's name is passed with
the form data and everything works fine.  When the user hits enter the
button in the form, the submit button's name doesn't get passed and the
doPerform event gets called instead.  This effectively breaks the form when
the enter key is pressed.
 
How do other people handle this problem??
 
Thanks,
 
David

RE: Form submittal problem

Posted by David Demner <tu...@demner.com>.
Hi Joe,

Thanks for the response.  I checked the form, and unfortunately it did have
the closing quote.  Based on your suggestion, I tried a few other
combinations of "/'//>, but nothing seemed to make it work.

I read a couple more sites, and apparently this is how IE works (other
browsers act differently - apparently Mozilla sends the name of the button
if you are in a textbox but not if you are in a checkbox or radio?!).  It
looks like the thinking behind this design is that if the user explicitly
clicks on a submit button, you know what should they intended.  If the user
presses enter, you don't necessarily know what's intended (but this is silly
since the first submit button is highlighted by default).  Oh well; doesn't
matter since that's the way it works.

The ugly workaround that I did was put a hidden field on the form named
defaultmethod with a value containing the name of the first submit on the
form and used that in doPerform to get the proper method to execute (sort of
a combination of the responses from Jürgen and Peter).  Pretty
disappointing, but there HAD to be something wrong with the way actions
worked ;)

Thanks for all the help everyone,

David


-----Original Message-----
From: Joe Morrogh [mailto:joe@morrogh.net] 
Sent: Sunday, March 28, 2004 2:37 PM
To: Turbine Users List
Subject: Re: Form submittal problem


Just a guess, but, I've seen that exact problem when the name attribute of
the input (type="submit") is missing a closing quote.
i.e.
<input type="submit" name="eventSubmit_doFoo value="Press Me">

Press the button, it works fine.  Press "enter", the name of the submit is
not sent.

HTH,
Joe
----- Original Message -----
From: David Demner <tu...@demner.com>
To: <tu...@jakarta.apache.org>
Sent: Friday, March 26, 2004 1:44 PM
Subject: Form submittal problem


> I'm trying to get around a form submittal problem.  I have a very simple
> form (1 text box and 1 submit button named eventsubmit_doWhatever) where
> method="post" and action="$link.setAction("MyAction")".
>
> When the user clicks on the button, the submit button's name is passed
with
> the form data and everything works fine.  When the user hits enter the
> button in the form, the submit button's name doesn't get passed and the
> doPerform event gets called instead.  This effectively breaks the form
when
> the enter key is pressed.
>
> How do other people handle this problem??
>
> Thanks,
>
> David
>

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


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


Re: Form submittal problem

Posted by Joe Morrogh <jo...@morrogh.net>.
Just a guess, but, I've seen that exact problem when the name attribute of
the input (type="submit") is missing a closing quote.
i.e.
<input type="submit" name="eventSubmit_doFoo value="Press Me">

Press the button, it works fine.  Press "enter", the name of the submit is
not sent.

HTH,
Joe
----- Original Message -----
From: David Demner <tu...@demner.com>
To: <tu...@jakarta.apache.org>
Sent: Friday, March 26, 2004 1:44 PM
Subject: Form submittal problem


> I'm trying to get around a form submittal problem.  I have a very simple
> form (1 text box and 1 submit button named eventsubmit_doWhatever) where
> method="post" and action="$link.setAction("MyAction")".
>
> When the user clicks on the button, the submit button's name is passed
with
> the form data and everything works fine.  When the user hits enter the
> button in the form, the submit button's name doesn't get passed and the
> doPerform event gets called instead.  This effectively breaks the form
when
> the enter key is pressed.
>
> How do other people handle this problem??
>
> Thanks,
>
> David
>

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


Re: Form submittal problem

Posted by Louis Moore <lr...@yahoo.com>.
If you have three buttons available and three
functions in your action, say doAdd, doUpdate, and
doDelete, and you want the doAdd function to be the
default (i.e. gets executed when the enter key is
pressed rather than any button being clicked), can't
you just have in the doPerform method:

public void doPerform(RunData data, Context context)
throws Exception
    {
         //Default action
         doAdd(data,context);
    }

I know I've used this in the past. Doesn't the
doPerform function only get executed if no button is
clicked?

-Lou

--- David Demner <tu...@demner.com> wrote:
> I'm trying to get around a form submittal problem. 
> I have a very simple
> form (1 text box and 1 submit button named
> eventsubmit_doWhatever) where
> method="post" and
> action="$link.setAction("MyAction")".
>  
> When the user clicks on the button, the submit
> button's name is passed with
> the form data and everything works fine.  When the
> user hits enter the
> button in the form, the submit button's name doesn't
> get passed and the
> doPerform event gets called instead.  This
> effectively breaks the form when
> the enter key is pressed.
>  
> How do other people handle this problem??
>  
> Thanks,
>  
> David
> 


__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html

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


AW: Form submittal problem

Posted by Jürgen Hoffmann <jh...@byteaction.de>.
Hi,

just put a hidden field into the form. <input type="hidden"
name="eventSubmit_doWhatever" value="1"/>

kind regards

Jürgen Hoffmann

-----Ursprüngliche Nachricht-----
Von: David Demner [mailto:turbine@demner.com] 
Gesendet: Freitag, 26. März 2004 19:45
An: turbine-user@jakarta.apache.org
Betreff: Form submittal problem

I'm trying to get around a form submittal problem.  I have a very simple
form (1 text box and 1 submit button named eventsubmit_doWhatever) where
method="post" and action="$link.setAction("MyAction")".
 
When the user clicks on the button, the submit button's name is passed with
the form data and everything works fine.  When the user hits enter the
button in the form, the submit button's name doesn't get passed and the
doPerform event gets called instead.  This effectively breaks the form when
the enter key is pressed.
 
How do other people handle this problem??
 
Thanks,
 
David


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