This question is locked. New answers and comments are not allowed.
Hi all,
have a fairly simple grid (version 2011.2.712.340) with ajax binding. The grid has editing set to popup. Everything was working fine till today. The "Add New Record" popup or the "Edit" popup.
I got issue on Grid edit popup window save button. When I click save button twice it will save two reocrd in grid. I want to disable save button on single click and enable after save record.
Any Idea about how handle this.
Thanks
have a fairly simple grid (version 2011.2.712.340) with ajax binding. The grid has editing set to popup. Everything was working fine till today. The "Add New Record" popup or the "Edit" popup.
I got issue on Grid edit popup window save button. When I click save button twice it will save two reocrd in grid. I want to disable save button on single click and enable after save record.
Any Idea about how handle this.
Thanks
10 Answers, 1 is accepted
0

venky
Top achievements
Rank 1
answered on 10 Jul 2012, 02:44 PM
I am facing the same problem of posting twice from the save button in InCell editing mode.
Anybody @Telerik please help.
Thanks
Anybody @Telerik please help.
Thanks
0

Pedro
Top achievements
Rank 2
answered on 11 Jul 2012, 05:05 PM
Try adding this to the bottom of your page:
Pedro
<
script
>
$('input[type="submit"]').on('click', function () {
$(this).attr('disabled','disabled');
});
</
script
>
Pedro
0

Rajeev
Top achievements
Rank 1
answered on 15 Aug 2012, 04:56 PM
Hi Pedro-Martir,
Thanks your reply.
I have added this script on my view. I got this error "Microsoft JScript runtime error: Object doesn't support property or method
on this line.
Thanks your reply.
I have added this script on my view. I got this error "Microsoft JScript runtime error: Object doesn't support property or method
on this line.
$('input[type="submit"]').on('click', function () {
$(this).attr('disabled','disabled');
});
Thanks!
0

Yui
Top achievements
Rank 1
answered on 11 Dec 2012, 02:45 PM
sorry wrong post
0

Keith
Top achievements
Rank 2
answered on 21 May 2013, 08:02 PM
I am assuming there is no answer for this? I am not getting this example to work - AT ALL! I am getting so tired of having to find a work around for pretty much everything we need to do. Yes, the grid is great at displaying data but try to interact in a business mode and the whole house of cards comes tumbling down. <bleh/>
So yes - HOW DO YOU DO THIS???
So yes - HOW DO YOU DO THIS???
0

Pedro
Top achievements
Rank 2
answered on 21 May 2013, 08:11 PM
Hello Keith,
What do you need?
What do you need?
0

Pedro
Top achievements
Rank 2
answered on 21 May 2013, 08:14 PM
@Keith
this is using the latest jquery.
try this:
You can see it working here jsfiddle
if the popup window is being created on the fly then we have to change the code to reflect it. like so:
You can see this one working here other jsfiddle
this is using the latest jquery.
try this:
<
script
>
$('input:submit').on('click', function () {
$(this).prop('disabled',true);
});
</
script
>
You can see it working here jsfiddle
if the popup window is being created on the fly then we have to change the code to reflect it. like so:
$(document).on('click', 'input:submit', function () {
$(this).prop('disabled',true);
});
You can see this one working here other jsfiddle
0

Keith
Top achievements
Rank 2
answered on 21 May 2013, 10:05 PM
Yes, on an <input> tag it works fine. Unfortunately your grid control does not create an <input> tag. Instead I see this:
Currently, I am *TRYING* to do it this way:
Unfortunately, it appears that the preventDefault() does nothing as far as the AJAX call is concerned. I am still getting double and triple saves (just click on the Update "button" real fast.) This will NOT pass QA!
Any other suggestions?
<
a
href
=
"#"
class
=
"t-button t-grid-insert t-button-icontext"
><
span
class
=
"t-icon t-insert"
></
span
>Insert</
a
>
<
a
href
=
"#"
class
=
"t-button t-grid-cancel t-button-icontext"
><
span
class
=
"t-icon t-cancel"
></
span
>Cancel</
a
>
Currently, I am *TRYING* to do it this way:
function onSave(e) {
var dataItem = e.dataItem;
var values = e.values;
var form = e.form;
if ($(".t-button.t-grid-update.t-button-icontext").attr("disabled") == "disabled") {
e.preventDefault();
}
if ($(".t-button.t-grid-insert.t-button-icontext").attr("disabled") == "disabled") {
e.preventDefault();
}
//++ TODO - Disable Update/Insert links when clicked...
$(".t-button.t-grid-update.t-button-icontext").attr("disabled", "disabled");
$(".t-button.t-grid-insert.t-button-icontext").attr("disabled", "disabled");
}
Unfortunately, it appears that the preventDefault() does nothing as far as the AJAX call is concerned. I am still getting double and triple saves (just click on the Update "button" real fast.) This will NOT pass QA!
Any other suggestions?
0

Pedro
Top achievements
Rank 2
answered on 21 May 2013, 10:19 PM
Hello Keith,
I was under the impression it was an input tag. I apologize.
Since it is an anchor tag.
Yes, here is my suggestion:
This would be the best way to stop multiple clicks.
now this will remove the click event from the Insert anchor tag. Does your page do a post back after insert? If so, this solution will work 100%.
If you are using ajax, you'll have to test it out for me.
Thanks,
Pedro
I was under the impression it was an input tag. I apologize.
Since it is an anchor tag.
Yes, here is my suggestion:
This would be the best way to stop multiple clicks.
$(document).on('click', '.t-grid-insert', function () {
$(this).unbind('click');
});
now this will remove the click event from the Insert anchor tag. Does your page do a post back after insert? If so, this solution will work 100%.
If you are using ajax, you'll have to test it out for me.
Thanks,
Pedro
0

Keith
Top achievements
Rank 2
answered on 21 May 2013, 10:57 PM
This is your Grid control. I really do not understand where in the chain of events the AJAX call to my controller/action happens. I'm not sure why the solution was given as if you expected an <input> tag when in reality your grid produces an <a> tag. And, if there are errors with the submission then it will come back to the popup and should allow the user to continue making changes and submit again - without closing the popup during the AJAX call. So, while you example shows me how to unbind the click event, how would I rebind the correct handler to the click event in the case of an error?