By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,569 Members | 1,181 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,569 IT Pros & Developers. It's quick & easy.

'Show Region' based on list/menu selection

P: 87
Greetings,

I have an ASP Insert Record Form that I wish to build the following functionality...

On the form is a list/menu (PIC_ITRequired) that has two options: 'Yes' and 'No'. When a user selects 'Yes', I then want a specific text field (ITG_No) -- which is hidden on the base form -- to appear. If the user selects 'No', I want a different text field (ITG_No2) to appear.

I have some knowledge to alter code for the 'Show Region' server behavior in Dreamweaver CS3 (example below), but I'm not sure how to code the IF statement that I described above.

Whatever help anyone can offer would be much appreciated!

Regards,

JM

Example of Show Region server behavior previously used:
Expand|Select|Wrap|Line Numbers
  1. <% If (DateDiff("d",(EZPTS.Fields.Item("entry_date").Value),Date)) < 15 Then %>
  2.                 <td width="42"><div align="center" name="div1"><a href="ezpts_delete.asp?ID=<%=(EZPTS.Fields.Item("ID").Value)%>">Delete</a></div>
  3.                 <% End If  %>                </td>
Jul 29 '08 #1
Share this Question
Share on Google+
4 Replies


jhardman
Expert 2.5K+
P: 3,405
since this is going to happen on runtime as the user interacts with it, this will have to be done with javascript or similar (ASP ceases to work as soon as it arrives at the client. It is purely a server-side technology). I could probably get a javascript solution to work, but I'm not really an expert, so I think I'll refer you to the JS forum.

Jared
Jul 30 '08 #2

acoder
Expert Mod 15k+
P: 16,027
Use the onchange event to call a function. You could pass it a reference of the select element or even its value, e.g.
[html]<select ... onchange="showTextField(this.value)">[/html]
Expand|Select|Wrap|Line Numbers
  1. function showTextField(val) {
  2. // if yes show ITG_No.
  3. ITG_No.style.display="block";//ITG_No is reference to the text box
  4. // if no, show the other one...
  5. }
Jul 31 '08 #3

P: 87
Thanks a bunch, guys! This helps a lot.

JM
Aug 1 '08 #4

acoder
Expert Mod 15k+
P: 16,027
You're welcome. Glad to hear that it worked :)
Aug 1 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.