I have a javascript function, confirmExit, that iterates through the controls on the page to see if changes have been made. It compares the values to an Array that contains the initial values. The function works great for text boxes, radio buttons and check boxes. I am trying to enhance it to work for the RadComboBox.
The function is below. I have not been able to change the function so that it detects whether the element is a radComboBox and then gets the VALUE of the radComboBox instead of the TEXT of the radComboBox.
function confirmExit() {
if (needToConfirm) {
// check to see if any changes to the data entry fields have been made
for (var i = 0; i < values.length; i++)
{
var elem = document.getElementById(ids[i]);
if (elem)
if ((elem.type == 'checkbox' || elem.type == 'radio')
&& values[i] != elem.checked)
return "You have not saved your changes. Click CANCEL to go back and save your changes,"
else if (!(elem.type == 'checkbox' || elem.type == 'radio') &&
elem.value != values[i])
return "You have not saved your changes. Click CANCEL to go back and save your changes,"
}
// no changes - return nothing
}
}
The function is below. I have not been able to change the function so that it detects whether the element is a radComboBox and then gets the VALUE of the radComboBox instead of the TEXT of the radComboBox.
function confirmExit() {
if (needToConfirm) {
// check to see if any changes to the data entry fields have been made
for (var i = 0; i < values.length; i++)
{
var elem = document.getElementById(ids[i]);
if (elem)
if ((elem.type == 'checkbox' || elem.type == 'radio')
&& values[i] != elem.checked)
return "You have not saved your changes. Click CANCEL to go back and save your changes,"
else if (!(elem.type == 'checkbox' || elem.type == 'radio') &&
elem.value != values[i])
return "You have not saved your changes. Click CANCEL to go back and save your changes,"
}
// no changes - return nothing
}
}