hiding radio button doesn't hide text ?

Use this board to ask questions or have discussions with other Rich Displays users.
Post Reply
amc
Profound User
Posts: 67
Joined: Thu Jul 29, 2010 1:25 am
First Name: Tony
Last Name: Cusack
Company Name: Welding Industries
City: Adelaide
State / Province: Outside Canada/USA
Zip / Postal Code: 5139
Country: Australia
Location: Adelaide, South Australia
Contact:

hiding radio button doesn't hide text ?

Post 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 ?
Attachments
after applying visibility attribute of "hidden" to rep & sales  fieldsets, buttons & links (email not changed)
after applying visibility attribute of "hidden" to rep & sales fieldsets, buttons & links (email not changed)
2.png (5.8 KiB) Viewed 1904 times
before applying visibility attribute of "hidden"
before applying visibility attribute of "hidden"
1.png (9.42 KiB) Viewed 1907 times
User avatar
Brian
Profound Logic Staff Member
Posts: 286
Joined: Thu Apr 14, 2011 10:23 am
First Name: Brian
Last Name: May
Company Name: Profound Logic Software
Contact:

Re: hiding radio button doesn't hide text ?

Post 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?
amc
Profound User
Posts: 67
Joined: Thu Jul 29, 2010 1:25 am
First Name: Tony
Last Name: Cusack
Company Name: Welding Industries
City: Adelaide
State / Province: Outside Canada/USA
Zip / Postal Code: 5139
Country: Australia
Location: Adelaide, South Australia
Contact:

Re: hiding radio button doesn't hide text ?

Post 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
amc
Profound User
Posts: 67
Joined: Thu Jul 29, 2010 1:25 am
First Name: Tony
Last Name: Cusack
Company Name: Welding Industries
City: Adelaide
State / Province: Outside Canada/USA
Zip / Postal Code: 5139
Country: Australia
Location: Adelaide, South Australia
Contact:

Re: hiding radio button doesn't hide text ?

Post 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;
		}
	}
}
User avatar
Brian
Profound Logic Staff Member
Posts: 286
Joined: Thu Apr 14, 2011 10:23 am
First Name: Brian
Last Name: May
Company Name: Profound Logic Software
Contact:

Re: hiding radio button doesn't hide text ?

Post 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.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests