Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 9th, 2006, 06:23 PM
Authorized User
 
Join Date: Oct 2006
Location: , , .
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default Need help…any suggestions

Hello,
Here is the code:
<tr>
<tr>
<td class="FormCell">Do you live in US? </td>
<td class="FormCell"><input type="radio" value="true" name="Country">Yes</td>
<td class="FormCell"><input type="radio" value="false" checked name="Country">No</td>
</tr>

    <% if true then %>
        <td class="FormCell"> This is a test </td>
<td class="FormCell" colspan="2"><select name="TEST">
        <option selected value="1">0 to 2500</option>
                  <option value="2">2,501 to 5,000</option>
                  <option value="3">5,001 to 8,000</option>
                  <option value="4">8,001 to 20,000</option>
                 <option value="5">over 20,000</option>
                  </select></td>
            <% end if %>
</tr>

What I want is that when the page loads the No (Radio Button) is selected (that is by default) and than if the user select the Yes radio button than the dropdown list shows up (TEST).
I guess there r two ways to do that:
• Using DHTML (java script)
• Or some how using the post back function
I will really appreciate yr help. It’s kind of urgent.
Thanks a lot for yr time & effort.
Ricky



Reply With Quote
  #2 (permalink)  
Old December 10th, 2006, 06:31 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

try:

<html>
<head>
    <title>Untitled</title>
<script>
  function hide( control, division ) {
   controlChecked = true;
   var mystate = document.all["_state"];
   if ( control.type == "radio" &&
                control.value.substring(0,2) == "No" )
       controlChecked = false;
      if ( control.checked == false )
       controlChecked = false

   if ( controlChecked == true ) {
      document.all[division].style.visibility = "visible";
      if ( mystate.value.indexOf(division) == -1 )
           mystate.value = mystate.value + division + " ";
  } else {
      document.all[division].style.visibility = "hidden";

      if ( mystate.value.indexOf(division) != -1 ) {
          var ar = mystate.value.split(" "+division+" ");
          if (ar.length > 1 )
              mystate.value = ar.join(" ");
          else
              mystate.value = ar[0];
      }
       var argc = arguments.length;

      for ( g = 2; g < argc; g++ ) {
         var elem = document.all[arguments[g]];

          if ( elem.type == "textarea" || elem.type == "text" ) {
              elem.value = "";
          } else {
              if ( elem.length ) {
                  for ( i = 0; i < elem.length; i++ ) {
                      if ( elem.item(i) ) {
                          elem.item(i).checked = false;
                      }
                  }
              } else {
                  elem.checked = false;
              }
          }
      }
 }
 }

 function init() {
      var mystate = document.all["_state"];
      if ( mystate.value != null && mystate.value != "" ) {
          var ar = mystate.value.split(" ");
          for ( i = 0; i < ar.length; i++ ) {
              if ( document.all[ar[i]] )
                  document.all[ar[i]].style.visibility = "visible";
          }
      }
 }
 </script>

</head>

<body onLoad="init();">
<form name="myform">
 <input type="radio" value="Yes" name="yn" onclick="hide(this,'mydiv','tb1','r1','cb1','ckc') " onclick="hide(this,'mydiv')"><b>Yes</b>
 <input type="radio" value="No" checked onclick="hide(this,'mydiv')" name="yn"><b>No</b>
 <div id="mydiv" class=hidesec>
 <select name="TEST">
  <option selected value="1">0 to 2500</option>
  <option value="2">2,501 to 5,000</option>
  <option value="3">5,001 to 8,000</option>
  <option value="4">8,001 to 20,000</option>
  <option value="5">over 20,000</option>
  </select>
 </div>
<Input Type="Hidden" Name="_state" Value="STATE ">
</body>
</html>

Wind is your friend
Matt
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
any suggestions? Acar BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 May 27th, 2008 07:19 AM
All suggestions are welcome! Wooger Other Programming Languages 0 September 24th, 2007 09:47 AM
I Need Some Suggestions??? hunzian78@yahoo.com ASP.NET 2.0 Professional 0 November 8th, 2006 02:14 AM
Suggestions lagoonblue Visual C++ 0 June 13th, 2005 07:18 PM
Some suggestions richard.york Forum and Wrox.com Feedback 0 October 13th, 2003 01:45 AM



All times are GMT -4. The time now is 07:25 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.