javascript - Is there any chance to get a button with double clicked after disabling it with one click? -


getting confusion button clicks in html page.i have set function button id avoid double clicks.double clicks causes double entries in database.it works fine now.but today again got 1 double entry in database.i unable find reason getting issue.there no errors in java class , jquery.please me in finding solution.for in advance.

my jquery code is:  $(function()   {   $('#timesheetform').submit(function(){   $("input[type='submit']", this).val("please wait...")   .attr('disabled', 'disabled');   settimeout('$("#btnsubmitintimesheet").removeattr("disabled")', 1500);   $("input[type='submit']", this).val("submit")   return true;  }); });  

java method:

    public static result save(long storeid) {     system.out.println("inside save method===========");     store store = store.find.byid(storeid);      long empid = long.parselong(form().bindfromrequest().get("empid"));     string startdate = form().bindfromrequest().get("date");     string enddate = form().bindfromrequest().get("enddate");     string leavetype = form().bindfromrequest().get("leavetype");     string status = form().bindfromrequest().get("status");      employee employee = employee.find.byid(empid);     system.out.println("selected employee id ========" + employee.id);     string jobtitle = employee.designation;     string firmtype = "store";      if (!leavetype.equals("none")) { // if selected 1 leave type          timesheet.create(empid, startdate, enddate, leavetype, "0", "0",                 "0", "0", "0:0", jobtitle, firmtype, storeid, status);     } else {         string starthours = form().bindfromrequest().get("starttimehour");         string startmins = form().bindfromrequest().get("starttimemins");         string endhours = form().bindfromrequest().get("endtimehour");         string endmins = form().bindfromrequest().get("endtimemins");         string duration = form().bindfromrequest().get("duration");          timesheet.create(empid, startdate, enddate, leavetype, starthours,                 startmins, endhours, endmins, duration, jobtitle, firmtype,                 storeid, status);         system.out.println("employeee saved is=========" + employee);     }     system.out.println("timesheet saved=========");     return redirect(routes.timesheets.showblank(storeid)); } 

you try disable button on submit, can pressed 1 time.


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -