This is a migrated thread and some comments may be shown as answers.

javascript reference for checking datachanged

4 Answers 114 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Bill
Top achievements
Rank 1
Bill asked on 13 Mar 2015, 10:01 PM
I'm running a script on window.onbeforeunload to check to see if the form is 'dirty'

this works for asp controls:

$('select').bind('change', function (event) { dataChanged = 1 })
$('input').bind('input', function (event) { dataChanged = 1 })

but I can't find an equivalent for a radComboBox or radDatePicker.
Anybody running this check?

Thanks

4 Answers, 1 is accepted

Sort by
0
Hristo Valyavicharski
Telerik team
answered on 18 Mar 2015, 02:21 PM
Hi Bill,

You will have to use the pageLoad event. It will be fired after all ajax control are initialized. 
<script type="text/javascript">
    function pageLoad() {
        var dp = $find("datePicker");
        var selectedDate = dp.get_selectedDate();
    }
</script>
<div>
    <telerik:RadDatePicker runat="server" ID="datePicker"></telerik:RadDatePicker>
</div>


Regards,
Hristo Valyavicharski
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Bill
Top achievements
Rank 1
answered on 19 Mar 2015, 06:23 PM
Thanks Hristo,

But that's not quite what I was looking for. 
I'd like to be able to generically check all radcomboboxes and raddatepickers rather than naming each one.
I'd like to have a script that I can apply to all pages rather than having to specify each control.

I can do that for html/asp controls using the $('select').bind call.

Does that make sense?

Thanks,
Bill



0
Hristo Valyavicharski
Telerik team
answered on 20 Mar 2015, 04:28 PM
Hi Bill,

What does it mean to "check" all comboboxes and raddatepickers? If you want to get reference of all combos and datepickers on the page you can use the following code:


var combos = Telerik.Web.UI.RadComboBox.ComboBoxes;
var inputs= $(".RadInput");

if you want  to attach event handler then you can define one event and attach it to all combos or datepickers.

Regards,
Hristo Valyavicharski
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Bill
Top achievements
Rank 1
answered on 20 Mar 2015, 04:45 PM
That's what I was looking for.

Thanks!
Tags
ComboBox
Asked by
Bill
Top achievements
Rank 1
Answers by
Hristo Valyavicharski
Telerik team
Bill
Top achievements
Rank 1
Share this question
or