Solved

Hide fields dependant on Dropdown value

Posted on 2014-04-30
1
236 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 51

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

746 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now