permaculture playing cards*
The moose likes JSF and the fly likes Command button click issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Command button click issue" Watch "Command button click issue" New topic
Author

Command button click issue

Arun Sudharsanam
Greenhorn

Joined: May 29, 2008
Posts: 21
Hi All,

I have an issue when submitting the form using commandbutton.

When the control is within a textbox and I click the command button the form does not gets submitted. But when I press tab and then click the button it gets submitted.

Can anyone provide a solution to overcome this problem.

I am using JSF 1.2 with Trinidad faces.


A S
Arshad Sharief
Greenhorn

Joined: Feb 23, 2006
Posts: 14

When the control is within a textbox and I click the command button

I believe that you are pressing enter key when control is within textbox, jsf does not support this. you have to use javascript to achieve it.


Arshad.
Srikanth Madasu
Ranch Hand

Joined: Sep 10, 2008
Posts: 48

Arshad, You can do it in JSF without using goofy javascript. All you need to do is use attribute type="submit" for your commandButton.

-Srik


If it's easy.. then everybody would do it!
Sergey Smirnov
Ranch Hand

Joined: May 29, 2003
Posts: 167
Originally posted by Srik Messmer:
Arshad, You can do it in JSF without using goofy javascript. All you need to do is use attribute type="submit" for your commandButton.

-Srik


The final behavior will be vary depends of the number of fields and browser type.
Arshad Sharief
Greenhorn

Joined: Feb 23, 2006
Posts: 14

Thanks srik, Iam using oracle adf commandButton which does not have an attribute of 'type'.

I might try to test how jsf commandButton behaves.


Arshad.
Mahendra Pratap
Ranch Hand

Joined: Feb 25, 2008
Posts: 42

sorry guys, i am also facing this same problem.

If anyone can help me the please do. when i am pressing enter while on textField then the same page is getting refresh but if i click on Submit button then it is giving me desired output.

it is working fine in FF and creating problem in IE.

adding type="submit" attribute is not working..


Mahendra
http://randomtechieblog.blogspot.com
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Please start a new topic instead of resurrecting an old and dead one.
Feel free to link the relevant topics in your new topic.
Mahendra Pratap
Ranch Hand

Joined: Feb 25, 2008
Posts: 42

hello Bauke Scholtz thanks for your reply..

i just resurrected this thread because my problem is same as the creator of this thread. i just thought that starting a new duplicate thread will not be good.

but ok from now onwards i will take care of this sort of issues. do i need to create a new thread now or it is fine for this time.
Mahendra Pratap
Ranch Hand

Joined: Feb 25, 2008
Posts: 42

thanks guys ..

i solved this problem by adding

<f:verbatim>
<input type="text" name="xyz" style="display: none;">
</f:verbatim>

just below <h:form> tag

now it is working fine with IE too...

and this problem exists only if you have only 1 input field(i.e. textField, textArea etc)
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Command button click issue