FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

Making some part of the form inactive/hidden

 


bukaida
I am designing a form where there is an option of having feedback at the last. There are two radio buttons (yes/no) on whether he/she is willing to give feedback or not. If yes is clicked, an option of entering name (text box) address(text area), email(textbox) and comments(text area) should be given. Initially they should be inactive/hidden, and should be active/visible only after clicking the yes radio button.Is it possible with javascript? please help.
badai
to be inactive, just add disabled at the input tag, then use javascript to enable it back (on click, check which button is clicked then enable / disable the input

to hide it, you need to use layer. set it hidden first, then use javascript to show it.
BlueVD
You can use javascript to show/hide the form without using layers. You can place the yes/no radio buttons outside the form and add an event handler for the onclick event and set the visibility of the form in the JS according to the clicked button. If you need the radio buttons to be in the same form, then you can set the visibility for each item that needs to be visible/hidden.
To this end you can use the CSS elements in javascript:
Code:
element.style.visibility="hidden";
element.visibility="visible";

You can get the elements by using the ID or by parsing the array of elements of the form.
bukaida
I am very new to javascript.So kindly help with a bit more code.It will be very much helpful if an example code with the radio button and form element can be given.Thank you in advance.
Reply to topic    Frihost Forum Index -> Scripting -> Html, CSS and Javascript

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.