I can only get this to half work.
I have to iterate through checkboxes, find "Other" one and see if it is checked and then show / hide an input.
I searched your sample code to loop the combobox checkboxes and could not get any of the functions to work. but it may also be the same issue that I did get working.
anyhow here is the code that works when called on page load (not from the combobox itself) to init my hide/show. <-- this code works
I have to iterate through checkboxes, find "Other" one and see if it is checked and then show / hide an input.
I searched your sample code to loop the combobox checkboxes and could not get any of the functions to work. but it may also be the same issue that I did get working.
anyhow here is the code that works when called on page load (not from the combobox itself) to init my hide/show. <-- this code works
function
ShowHideTextbox(sender, args, oDropID, oTextID, oLabelID) {
//var ddl = document.getElementById(oDropID);
var
oTextbox = document.getElementById(oTextID);
var
oLabel = document.getElementById(oLabelID);
var
bShow =
false
;
$(
'#'
+ oDropID +
' INPUT'
).each(
function
() {
// alert(this);
if
(
this
.type ==
"checkbox"
) {
if
(
this
.checked) {
var
sText =
this
.nextSibling.data;
if
(sText ==
"Other"
) bShow =
true
;
}
}
});
if
(bShow) {
oLabel.style.display =
'inline'
;
oTextbox.style.display =
'inline'
;
oTextbox.focus();
}
else
{
oLabel.style.display =
'none'
;
oTextbox.style.display =
'none'
;
}
}
but when this is called from the combobox using the .OnClientItemChecked there are only 2 items in this loop (text + hidden)
it is like the div isn't built out yet. is it calling it too soon to loop the items?
I have verified both calling from page load and combobox sends in the same values.