This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Servlets and the fly likes Can a double-click or multi-click of a submit button be forced as ONE submit click ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Can a double-click or multi-click of a submit button be forced as ONE submit click ?" Watch "Can a double-click or multi-click of a submit button be forced as ONE submit click ?" New topic
Author

Can a double-click or multi-click of a submit button be forced as ONE submit click ?

Mallika Kumar
Ranch Hand

Joined: Feb 15, 2001
Posts: 61
Hi,
I have an interface where a user enters some information into text fields, and queries on them. Every submit button click is a hit to the database, where the query is executed, and its results are displayed. Sometimes, by mistake, the user hits submit button twice, so two database hits occur, wherein, it should be only one database hit. Can I force multiple submit button hits as one submit button hit ? I'm using JSP/Java Beans/EJB tiers. In my JSP tier, can I force this functionality ?
Any response will be appreciated.
Thanks.
Adam Hardy
Ranch Hand

Joined: Oct 09, 2001
Posts: 566
I don't think there's anything you can do server-side, but you could put some javascript in the page. this is what i do - i set the onsubmit event of the form element to the function with
onsubmit="return trySubmit();";


I have seen things you people would not believe, attack ships on fire off the shoulder of Orion, c-beams sparkling in the dark near the Tennhauser Gate. All these moments will be lost in time, like tears in the rain.
amit ang
Ranch Hand

Joined: Sep 28, 2001
Posts: 38
Hi
What i think is at the max u can call the javascript function and get the confirmation fro the client and disable the button.
Amit
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can a double-click or multi-click of a submit button be forced as ONE submit click ?