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.
Making some part of the form inactive/hidden
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.
to hide it, you need to use layer. set it hidden first, then use javascript to show it.
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:
You can get the elements by using the ID or by parsing the array of elements of the form.
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.
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.
