Solved

Hide fields dependant on Dropdown value

Posted on 2014-04-30
1
239 Views
Last Modified: 2014-05-04
Hi Experts,


I have the following ASP code which gets its values from a MDB. The options pulled from the MDB are Yes and No:

  <td style="width:160px;" colspan="2" class="TableSubSection">
       
          <select style="width:200px;" id="Select1" size="1" name="x_TrialSoftware">
          <% FillComboBox "tblTrialSoftware","TrialSoftwareID","TrialSoftware",x_TrialSoftware, true %>
        </select>
      </td>

What i want to do is, if the user selects Yes from the dropdown another free txt box should appear:

    <tr>
      <th style="width:12%;" class="TableSubSection">
     Is this a trial piece of software:*<a href="#" class="tooltip" style="color:white"><img src="images/information.png" style="border:none;height:20px;width:20px" /> <span>Please specify if you have a requirement to trial the software prior to it going into Production. (Please be aware that LV=’s general rule is a maximum of three users to trial providing the vendor’s license terms and conditions permits.)</span>     </a>  
      </th>
      <td style="width:88%" class="FieldEditable">
          <input style="width: 97%" id="x_TrialSoftware" name="x_TrialSoftware" value="<%=x_TrialSoftware%>" maxlength="70" size="93"/>
      </td>
      </tr>
     

I have attached an attachment to explain further,

Many thanks,
ee.jpg
0
Comment
Question by:Richiep86
1 Comment
 
LVL 54

Accepted Solution

by:
Julian Hansen earned 500 total points
ID: 40031768
Here is a solution using JQuery
Replace the select and textbox value with your asp code to initialise the page
<!doctype html>
<html>
<head>
<title>Test</title>
<script src="http://code.jquery.com/jquery.js"></script>
<script type="text/javascript">
$(function() {
  $('#Select1').change(function() {
    if ($(this).val() == 'Yes') {
      $('#Select1_input').fadeIn(300);
    }
    else {
      $('#Select1_input').hide();
    }
  });
});
</script>
<style type="text/css">
</style>
</head>
<body>
<table>
  <tr>
    <th style="width:12%;" class="TableSubSection">
      Is this a trial piece of software:*<a href="#" class="tooltip" style="color:white"><img src="images/information.png" style="border:none;height:20px;width:20px" /> <span>Please specify if you have a requirement to trial the software prior to it going into Production. (Please be aware that LV=’s general rule is a maximum of three users to trial providing the vendor’s license terms and conditions permits.)</span>     </a>  
    </th>
    <td style="width:160px;" colspan="2" class="TableSubSection">
      <select style="width:200px;" id="Select1" size="1" name="x_TrialSoftware">
        <option value="">Please Select</option>
        <option value="No">No</option>
        <option value="Yes">Yes</option>
      </select>
    </td>
  </tr>
  <tr  id="Select1_input" style="display:none">
    <th style="width:12%;" class="TableSubSection">
      Is this a trial piece of software:*<a href="#" class="tooltip" style="color:white"><img src="images/information.png" style="border:none;height:20px;width:20px" /> <span>Please specify if you have a requirement to trial the software prior to it going into Production. (Please be aware that LV=’s general rule is a maximum of three users to trial providing the vendor’s license terms and conditions permits.)</span>     </a>  
    </th>
    <td style="width:88%" class="FieldEditable">
      <input style="width: 97%" id="x_TrialSoftware" name="x_TrialSoftware" value="test" maxlength="70" size="93"/>
    </td>
  </tr>
</table>
</body>
</html>

Open in new window

Working sample here http://www.marcorpsa.com/ee/t659.html
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question