Solved

Hide fields dependant on Dropdown value

Posted on 2014-04-30
1
242 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 57

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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
CTAs encourage people to do something specific to show interest in your company, product or service. Keep reading to learn why CTAs should always be thought of as extremely important, albeit small, sections of websites.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

728 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