This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Button invisible problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Button invisible problem" Watch "Button invisible problem" New topic
Author

Button invisible problem

payal Jain
Ranch Hand

Joined: Dec 20, 2007
Posts: 50
hi I am making submit button invisible so as when user enters the data and press "Enter" it should submit the form.
using style="visibility:hidden;"
The problem is when the button is visible,and on pressing "Enter" it submits the form,
but when i make it invisible it dosent submits the form on pressing "Enter".
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60765
    
  65

Oh, I think that's the browser being too smart for its own good.

Try making the button 1 pixel by 1 pixel and white (or whatever your background color is).


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
payal Jain
Ranch Hand

Joined: Dec 20, 2007
Posts: 50
Thanks it worked
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Haven't seen this behaviour before.

Which web browser exactly was you using? How does the actual form look like?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60765
    
  65

I know that this "problem" exists in IE -- a non-displayed submit button is non-functional. I'm not sure about other browsers, but it should be easy enough to test.
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Couldn't reproduce this in IE 6.0 and 7.0. Even not with a buttonless form.

Both forms works fine.
Stoyan Stefanov
author
Ranch Hand

Joined: Jul 16, 2008
Posts: 61
yeah, if the purpose is just to submit the form without a submit button, simply don't put any button, like in Bauke's first example.

Alternatively, does it work for you if you hide the button with display: none, as opposed to visibility: hidden


<a href="http://www.thinkinginjavascript.com" target="_blank" rel="nofollow">my OOJS book</a>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Button invisible problem
 
Similar Threads
Form and commandButton
problem with submit button in konqueror
HTML qn=== Urgent!!!
problem in struts applicaion using javascript
How to submit form with return