/    Sign up×
Community /Pin to ProfileBookmark

Hiding and showing form controls – creating dynamic forms

Hi,

I am trying to create a dynamic Form.

I want to keep subsidiary form controls hidden until they are needed in response to other control settings.

For example, the following excerpt from a Survey form should have nested controls that remain hidden until the user answers Yes to question number 4: Question 4(a) and Question 5 should remain hidden until the User answers Yes to Question 4. Can you please help me with the code? Also I have to make it work in Croos -Browser platform.

<form name=”survey”>

<p>3. How much do you use a personal computer
to complete your daily job tasks?

<input type=”radio” name=”q40″ value=”4″> 0 to 2
Hours <br>
<input type=”radio” name=”q40″ value=”3″>3 to 5
Hours <br>
<input type=”radio” name=”q40″ value=”2″>5 to8
Hours <br>
<input type=”radio” name=”q40″ value=”1″>More than 8 Hours<br>

<p>4.In the last three months have you experienced a problem or annoyance in using CHE Web site to transact business ?
<input type=”radio” name=”q43″ value=”5″>No<br>
<input type=”radio” name=”q43″ value=”4″>Yes<br>

<P>4(a). If yes, please describe what happened </tr>
<textarea name=”q44″ cols=”30″ rows=”3″ class=”formElements”></textarea>

<p>5. Overall, how satisfied are you
with the way CHE addressed this problem or annoyance

<input type=”radio” name=”q45″ value=”5″> Very
Satisfied<br>
<input type=”radio” name=”q45″ value=”4″>Satisfied<br>
<input type=”radio” name=”q45″ value=”3″> Neutral<br>
<input type=”radio” name=”q45″ value=”2″> Dissatisfied<br>

<input type=”radio” name=”q45″ value=”1″>Very Satisfied<br>

<P>6. Additional Suggestions and Comments

<textarea name=”q49″ cols=”30″ rows=”3″ class=”formElements”></textarea><br>

<INPUT TYPE=hidden name=”q50″>
<input name=”BUTTON” type=”button” value=”submit”>
</form>

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @mollya spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...