close ad
WARNING PC USERS: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

How to display a hidden area when a radio button is checked?

Thread began 7/27/2015 10:13 am by Nathon Jones Web Design | Last modified 7/27/2015 6:20 pm by Nathon Jones Web Design | 821 views | 8 replies

Nathon Jones Web Design

You make it sound so simple! I tried this...

<form>
<input type="radio" name="TMSAmembershipratesID" id="TMSAmembershipratesID1" value="Panda Skin Member"> Panda Skin

<input type="radio" name="TMSAmembershipratesID" id="TMSAmembershipratesID2" value="Platinum Member" onclick="if (document.getElementById('TMSAmembershipratesID2').checked) document.getElementById('reveal-if-active').style.display = 'block';"> Platinum (this is the trigger)

<input type="radio" name="TMSAmembershipratesID" id="TMSAmembershipratesID3" value="Gold Member"> Gold

<div id="reveal-if-active">
<input name="otherfield" id="otherfield" type="text" class="form-control">
</div>
</form>

And I have the following in my CSS:
#reveal-if-active {
display: none;
}

...but the hidden field doesn't display and checking the trigger radio button doesn't reveal it?
Awaits you pointing out the obvious. Thank you Ray.

NJ.

EDIT: It's working now, but when I select any of the other radio buttons, the revealed form field remains. So I tried to be smart and change my buttons to this:

<input type="radio" name="TMSAmembershipratesID" id="TMSAmembershipratesID1" value="Panda Skin Member" onclick="if (document.getElementById('TMSAmembershipratesID1').checked) document.getElementById('reveal-if-active').style.display = 'none';"> Panda Skin


<input type="radio" name="TMSAmembershipratesID" id="TMSAmembershipratesID2" value="Platinum Member" onclick="if (document.getElementById('TMSAmembershipratesID2').checked) document.getElementById('reveal-if-active').style.display = 'block';"> Platinum (this is the trigger)

<input type="radio" name="TMSAmembershipratesID" id="TMSAmembershipratesID3" value="Gold Member" onclick="if (document.getElementById('TMSAmembershipratesID3').checked) document.getElementById('reveal-if-active').style.display = 'none';"> Gold

Will the hidden form field still be submitted, albeit with a blank value, if it's not 'revealed'?

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...