This question is locked. New answers and comments are not allowed.

Temesgen Meheret
Top achievements
Rank 1
Temesgen Meheret
asked on 06 Aug 2010, 03:25 AM
We were implementing autosave when input form fields changes. It works perfect with non-telerik textboxes, but binding the change event to numeric textboxes couldn't work.
The autosave plugin we are using is jQuery AutoSave plugin. (August 2009)
Below is excerpt from the plugin.
The autosave plugin we are using is jQuery AutoSave plugin. (August 2009)
Below is excerpt from the plugin.
/**
* For each element selected (typically a list of form elements
* that may, or may not, reside in the same form
* Build a list of these nodes and bind them to some
* onchange/onblur events for submitting
*/
elems.each(function(i) {
eventName = $(this).is('button,:submit') ? 'click' : 'change';
$(this).bind(eventName, function(e) {
eventName == 'click' ? e.preventDefault() : false;
$.fn.autosave._makeRequest(e, nodes, options, this);
});
});
The event binding works perfect for all other input types except telerik numeric textbox. If you would please assist.
Thanks,
The event binding works perfect for all other input types except telerik numeric textbox. If you would please assist.
Thanks,
5 Answers, 1 is accepted
0

Mark
Top achievements
Rank 1
answered on 06 Aug 2010, 08:33 AM
I think it's because if you look at the underlying html generated by the numeric textboxes you will see it created 2 input elements wrapped inside a div element. In order to get that value of the numeric textbox you need to call
so just looking at the snippet you posted, it's going to try and access the input elements directly, and in my experience that does not work.
With regards to the workaround, I'm not quite sure, I'm not too familiar with the autosave plugin and how you bind it to the input elements you wish to bind to, but you somehow need to bind it to the
Hope this helps
Cheers Mark
$('#NAME_GIVEN-TO_NUMERIC-BOX').data("tTextBox").value();
so just looking at the snippet you posted, it's going to try and access the input elements directly, and in my experience that does not work.
With regards to the workaround, I'm not quite sure, I'm not too familiar with the autosave plugin and how you bind it to the input elements you wish to bind to, but you somehow need to bind it to the
$('#NAME_GIVEN-TO_NUMERIC-BOX').data("tTextBox")
element of the form and not the input elements themselves.Hope this helps
Cheers Mark
0

Temesgen Meheret
Top achievements
Rank 1
answered on 06 Aug 2010, 05:12 PM
Yes you have understood the scenario.
I am using the numeric textboxes in editor templates, so I don't have control on their IDs. It will be assigned whatever ViewData.TemplateInfo.HtmlFieldPrefix returns.
So I need a away to:
- Grab all Numberic textboxes and inject a change behavior. What is the best way to achieve that?
Thanks.
I am using the numeric textboxes in editor templates, so I don't have control on their IDs. It will be assigned whatever ViewData.TemplateInfo.HtmlFieldPrefix returns.
So I need a away to:
- Grab all Numberic textboxes and inject a change behavior. What is the best way to achieve that?
Thanks.
0

Temesgen Meheret
Top achievements
Rank 1
answered on 06 Aug 2010, 06:17 PM
Finally I had to get inside the telerik.textbox.js blur handler and add my autosave call.
$input.autosave({
grouped: true,
success: function(data) {},
error: function(xmlReq, text, errorThrown) { alert("Error"); },
send: function(defaultAutosaveSendVisualizer) {},
});
I hope there is a better way of adding blur event handlers without modifying the telerik scripts.
$input.autosave({
grouped: true,
success: function(data) {},
error: function(xmlReq, text, errorThrown) { alert("Error"); },
send: function(defaultAutosaveSendVisualizer) {},
});
I hope there is a better way of adding blur event handlers without modifying the telerik scripts.
0

Temesgen Meheret
Top achievements
Rank 1
answered on 19 Aug 2010, 03:51 PM
Still having problem with event binding
- Basically I want to bind a handle to the Blur event of all numeric text boxes.
On-blur, I want to find the form they belong to and do a post action on it.
Any body who has tried that before?
- Basically I want to bind a handle to the Blur event of all numeric text boxes.
On-blur, I want to find the form they belong to and do a post action on it.
Any body who has tried that before?
0

Temesgen Meheret
Top achievements
Rank 1
answered on 21 Aug 2010, 04:18 AM
Selecting all div.t-numerictextbox elements and applying change event worked. But I had to move my event biniding logic from the Html head to the end of the body. This was because the telerik t-TextBox function doesn't get called until the end of the page.