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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hiding Form Objects

Status
Not open for further replies.

steve100

Technical User
Aug 15, 2002
35
GB
Does anyone know how to create a javascript to switch off form objects?

I have two radio buttons in a form one with the value "did" the other "didnt".

When someone selects the "didnt" button I want an input select drop down box called "priority" to disappear from the form.

Does anyone know how this can be done?

Thanks
Steve
 
divide one form into the several ones and put the form with field(s) you want to hide into the div. You can hide and visualaze div context using javascript. Gather the data together during submition.

Regards,
Sergey Smirnov
 
Why not just use the onClick for the radio to change the display of the select box?
Code:
Yep: <input type=&quot;radio&quot; name=&quot;bob&quot; value=&quot;yep&quot; onClick=&quot;document.getElementById('yepSelect').style.display='inline';&quot;><br>
Nope: <input type=&quot;radio&quot; name=&quot;bob&quot; value=&quot;nope&quot; onClick=&quot;document.getElementById('yepSelect').style.display='none';&quot;><Br>
<select name=&quot;selYep&quot; id=&quot;yepSelect&quot;>
	<option> Cuz I said yes, thats why </option>
	<option> Because </option>
	<option> Low on imagination tonight </option>
</select>

-Tarwn ________________________________________________________________________________
Want to get great answers to your Tek-Tips questions? Have a look at faq333-2924
 
How 'bout another onClick off the radio, after putting the input within

<a id=&quot;whatever&quot;>bit you want to loose here</a>

calling:

function hide()

{
myhtml=&quot;&quot;;
whatever.innerHTML = myhtml;
}

Anything wrong with that?
 
> Why not just use the onClick for the radio
> to change the display of the select box?

Just because hidden form items are not supported in Netscape 4.*. However, if you do not carry about such users, you can more flexible.

Regards,
Sergey Smirnov
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top