Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hide table row with only name of input field

Status
Not open for further replies.

TommyIndigo

Programmer
Sep 14, 2000
67
US
I have a select field I need to use to toggle visibility of other form fields. I am writing an onchange function to do this.

My problem is that the label for the field still appears...so I would like to hide the entire row. However, I cannot place an ID in the <TR> tag, as the form is generated BEFORE it gets to the code I am writing (I am just writing the validation and toggling script and have no control over the form html).

Can I possibly hide a table row WITH ONLY THE KNOWLEDGE OF A SINGLE FORM ELEMENT NAME?

Any advice would be most appreciated!!

If it is helpful, here is the relevant code I have so far.

Code:
		alert('This is NOT a formal decision.  Unused fields should be hidden.');
		
		//Identify the list of fields associated with formal decisions
		var FieldList = new Array(
			  	'DecisionTeam',
			  	'ProblemStatement',
			 	'EvaluationCriteria'
  				);
			  
		 //Loop through DAR fields and hide
            	var FieldListLength = FieldList.length;
	    	var counter=0; 
	  	for (counter=0; counter<FieldListLength; counter++) 
	  	{ 
		  var CurrentFieldName = FieldList[counter];
		  var FormFieldExaminedString = 'window.document.forms[0].'+CurrentFieldName;
		  var EvaluatedField = eval(FormFieldExaminedString);
		  EvaluatedField.style.display = 'none';
		}
 
how about this?
<tr id="nOP" style="visibility:hidden;">
<td>something</td>
</tr>

then you can
var obj1 = document.getElementById("nOP");

if (something happens)
{
obj1.style.visibility = "visible";
}
else
{
obj1.style.visibility = "hidden";
}

hope it helps
 
Thanks for the quick reply, but unfortunately I can't change the incoming HTML tags. That is generated from a 3rd party software vendor (who did not use IDs for their <TR> tags :(

The only info I have to use is the NAME attribute of the INPUT tags. So far I can hide the field itself, but just not the row it resides in. Any ideas?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top