This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Struts and the fly likes Hidden button is shown in FireFox 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 » Frameworks » Struts
Bookmark "Hidden button is shown in FireFox" Watch "Hidden button is shown in FireFox" New topic
Author

Hidden button is shown in FireFox

Ergin Er
Ranch Hand

Joined: Sep 06, 2005
Posts: 60
Hi all,

I'm using a submit button with width:0px to hide it. In IE it works, but in FF I get a S (of Submit).
Here is the code:

How do I hide this properly?
David Ulicny
Ranch Hand

Joined: Aug 04, 2004
Posts: 724
Try
style="visibility:hidden"
or
style="display:none"
[ October 20, 2005: Message edited by: David Ulicny ]

SCJP<br />SCWCD <br />ICSD(286)<br />MCP 70-216
Ergin Er
Ranch Hand

Joined: Sep 06, 2005
Posts: 60
Thanks for your reply. Both of them work.
The only problem is that IE now doesn't execute correctly when I use it.
The hidden button is to give the user the possiblilty to login without pressing login button but by using enter key. Now that is not properly recognized in IE. but thanks for helping me really hide the submit.
David Ulicny
Ranch Hand

Joined: Aug 04, 2004
Posts: 724
Maybe some javascript could help, the onkeydown event.
Ergin Er
Ranch Hand

Joined: Sep 06, 2005
Posts: 60
JavaScript not allowed
Fred Leclerc
Greenhorn

Joined: Aug 29, 2005
Posts: 3
Since you cannot use javascript, try replacing your input button by an input of type image. Depending on the visual aspect, the image could be a plain 1px by 1px image matching the background color. I'm pretty shure that if you display:none an submit button, IE won't submit when the enter key is pressed.

I've tested with a simple form, and if you put an input type image instead of a classic submit button, then add the style="cursor: default;".

Worked fine when I tested it .. hope it helped.

Regards.
alan do
Ranch Hand

Joined: Apr 14, 2005
Posts: 354
perhaps there's a way around what you are trying to achieve without a hidden button? we may be able to give some alternatives if we know what you're trying to do.


-/a<br />certified slacker...yes, my last name is 'do' - <a href="http://www.luckycouple.com" target="_blank" rel="nofollow">luckycouple.com</a>
Ergin Er
Ranch Hand

Joined: Sep 06, 2005
Posts: 60
Hi Alan,

The idea is to give the user 2 options to login to the site.
1- by pressing the login button
2- by pressing enter key within password/username field
Both are implemented as a "submit"
alan do
Ranch Hand

Joined: Apr 14, 2005
Posts: 354
instead of hidden button, using javascript, you can detect event = '13' for the 'onkeydown' attribute of the password field (user has pressed 'enter') and do form.submit() when that occurs. if you're concerned about JS compatibility issues, i think you'll have that with about 1-5% of the users (unless everyone is using netscape on mac). in those cases, a the 'click on button' option is still available.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hidden button is shown in FireFox