Page 1 of 1

hiding radio button doesn't hide text ?

Posted: Fri Jul 29, 2011 2:46 am
by amc
When I set the visibility attribute of a radio button to "hidden", the radio button hides but the radio button text remains visible .

bug ?

Re: hiding radio button doesn't hide text ?

Posted: Fri Jul 29, 2011 11:17 am
by Brian
I am not able to recreate this problem. So here are a couple of questions.

1. What version of ProfoundUI are you using?
2. Did you use the "Label" property of the radio button to set the text, or did you drag a label onto the screen for the text?

Re: hiding radio button doesn't hide text ?

Posted: Fri Jul 29, 2011 7:44 pm
by amc
Brian,

I neglected to say that I am manipulating the visible attribute of the radio buttons in JavaScript using the hideElement function provided by PUI.

A look at the DOM reveals that the label for a radio button isn't an attribute on the radio button as such, but rather a separate element of type label.

So the hideElement function is only hiding the radio button itself & not the label.

You are correct that using an indicator on the visibility attribute of a radio button correctly hides both the button & the label each time the screen is refreshed by the program, however in this particular case I need to be able to toggle visibility on the client side not the host side. It's a rather complex screen of interrelated data selection criteria. As certain buttons or check boxes are selected or de-selected, other option become available or not.

So a new question, how do I hide a label associated with a radio button in JavaScript seeing that it doesn't have an id ? Alternatively, can the hideElement function be fixed to hide the radio button label as well as the radio button itself ?

this is on version 3.05 by the way.

regards

Tony C

Re: hiding radio button doesn't hide text ?

Posted: Sun Jul 31, 2011 11:05 pm
by amc
further testing revealed that check box labels are handled just like radio button labels, they are not an attribute of the check box or radio button, but a separate element of type "label" with a "for" attribute referring to the id of the check box or radio button.

so for the time being, I am hiding or showing them with JavaScript functions in our js library - just give the radio button or check box id (code below).

Let me know if there is a better solution please Brian.

Thanks & regards

Tony C

Code: Select all

function wia_hideLabel(whichOne) {
	var labels = document.getElementsByTagName("label");
	for(var i = 0; i < labels.length; i++) {
		if(labels[i].htmlFor == whichOne) {
			labels[i].hidden = true;
		}
	}
}

function wia_showLabel(whichOne) {
	var labels = document.getElementsByTagName("label");
	for(var i = 0; i < labels.length; i++) {
		if(labels[i].htmlFor == whichOne) {
			labels[i].hidden = false;
		}
	}
}

Re: hiding radio button doesn't hide text ?

Posted: Tue Aug 02, 2011 3:52 pm
by Brian
Your solution will work, I think. Let me see if I can come up with something that doesn't require scanning all of the labels on the screen.