views:

244

answers:

3
Is this also the Risk Address:
<select name="InsuredSALicense2" id="InsuredSALicense2">
  <option>Please Select</option>
  <option>Yes</option>
  <option>No</option>
</select>

If the answer here is "No" then a hidden drop down must be created.

If No, Please give details: 
<textarea name="InsuredOther License2" 
          id="InsuredOther License2" 
          cols="30" rows="4"></textarea>
<form id="form4" name="form4" method="post" action="">

Say that on the form I want to create a drop down (example: "Do you...", please select yes/no): if the answer is "Yes" then drop down a section if no then don't drop down section.

This form was done in dreamweaver cs4.

A: 

Hi, are you wrokin in ASP.net?? If you are workin in ASP.net..you can create a hidden dropdown list on the event of Dropdownlist text change...first you can check what is the value of selected dropdown list... let me know if you have any questions

sona
A: 

I think the a good solution would be doing it client-side: so generate both the textarea and the dropdown menu. Hide the one that is not the default (style="visibility: hidden" for example). Then create an onchange event on the InsuredSALicense2 listbox, which hides the not important field and shows the important one.

+1  A: 

You could do this relatively easy. Using the javascript framework jQuery, you could do something like the following:

/* Attach an event to your dropdown menu containing Yes/No */
$("#InsuredSALicense2").change(function(){
  /* Check Value After Change */
  if (this.val() == "Yes") {
    /* Show the dropdown field */
    $("#hiddenDIV").show();
  } else {
    /* Hide the dropdown field */
    $("#hiddenDIV").hide();
  }
});

This example assumes your "hidden" dropdown is within a called "hiddenDIV":

<div id="hiddenDIV">
  <p>Hidden drop down stuff here</p>
</div>

To use this code-sample, you need to reference the jQuery library from your tag.

<head>
  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
</head>
Jonathan Sampson