• Post Reply Bookmark Topic Watch Topic
  • New Topic

click twice to save

 
Jolie Lee
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my form need to click twice on the commandButton only able to save. when i click the first time, no error, the page refresh and remains.. when i clicked on the 2nd time, it'll only save into the db.

i'm not sure wat's wrong. in my form, i have a selectOneMenu, onchange with valueChangeListener, and my commandButton used actionListener to link to the backing bean.

will it be the valueChangeListener caused this?

kindly advise. thks.
 
Jolie Lee
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've figured it out, it is the valuechangelistener that caused this thing happened!
 
Tim Holloway
Bartender
Posts: 18408
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you mean double-clicking, someone asked me a question like that just yesterday. Unlike GUI desktops, the web was designed for single-click operations. You can add double-click functionality via Javascript, but it's risky, since users can turn javascript off.

Trying to make double-clicking work without Javascript in JSF can be a problem, since if the user double-clicks, they're sending 2 page requests in rapid succession - probably too fast to be handled completely.

If, on the other hand, you literally want the button to do one thing when clicked once, but after an interval do something else next time, the best thing to do is visually modify the page as part of the first click's action process so that they can see that the next click will be different. This can be done as easily as changing the value of a boolean property queried by a "rendered=" attribute on a JSF page display object.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!