You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Andrew Hill <an...@gridnode.com> on 2002/11/15 13:40:20 UTC

enter enable [WAS: RE: enter disable]

Funnily enough I have the opposite problem.
I have a form that now uses a button or sometimes a link instead of a
submitButton to submit the form as it needs to do some stuff in javascript
prior to submission (including playing silly buggers with the forms action
property!).
This works fine except that in dropping the submit in favour of a plain
button Ive lost the 'submit on enter' behaviour.
How might I get it back while still being able to do my js stuff when the
user submits the form - including via 'enter'.?

-----Original Message-----
From: Gemes Tibor [mailto:gemes@regens.hu]
Sent: Friday, November 15, 2002 20:28
To: Struts Users Mailing List
Subject: Re: enter disable


2002. november 15. 13:06 dátummal Gus Delgado ezt írtad:
> How can I disable the <htm:text tag so that nothing will happen when the
> use hits the enter key. The way it works right now everytime you hit the
> enter key in a text field it tries to submit the request.  any flags
> that need to be turn off?

delete the submit button, put on a button which submits the form onClick.
This way you workaround the default (which is rather handy on the other
hand)

Tib


--
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>


Re: enter enable [WAS: RE: enter disable]

Posted by Gemes Tibor <ge...@regens.hu>.
2002. november 15. 13:40 dátummal Andrew Hill ezt írtad:
> Funnily enough I have the opposite problem.
> I have a form that now uses a button or sometimes a link instead of a
> submitButton to submit the form as it needs to do some stuff in javascript
> prior to submission (including playing silly buggers with the forms action
> property!).
> This works fine except that in dropping the submit in favour of a plain
> button Ive lost the 'submit on enter' behaviour.
> How might I get it back while still being able to do my js stuff when the
> user submits the form - including via 'enter'.?

You should provide a submit button in this case, 
and onClick you do the stuff you'd like to, and if everything went well, 
return true. In this case the form will be submitted. 

I do usually 

<html:submit onclick="return confirm('are you sure?');">
<bean:message key="prompt.submit"/>
</html:submt>



Hth

Tib

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