Solved

How to refresh form page after selection from dropdown?

Posted on 2010-08-19
3
529 Views
Last Modified: 2012-05-10
I have a hidden text area that I would like to show when a particular selection is made from a dropdown box using classic asp.
So I figure the form page would need to refreshed?
I have tried this

 onchange="this.form1.submit()"

but it doesn't work.

Thanks in advance experts.


0
Comment
Question by:colonelblue
  • 2
3 Comments
 
LVL 18

Expert Comment

by:Rajar Ahmed
ID: 33482001
Are you doing Show/hide process according to selecton of dropdown ?
<html xmlns="http://www.w3.org/1999/xhtml" >

<head runat="server">

    <title>Untitled Page</title>

    <script type="text/javascript">

function ChangeDropdowns(value){



if(value=="diff"){

document.getElementById('text_are').style.display='none';

}else if(value=="all"){

document.getElementById('text_are').style.display='block';

}

else

{

document.getElementById('all_fields').style.display='none';

}

}

</script>

</head>

<body>

    <form id="form1" runat="server">

    <div>

    <select id="test" name="test" onchange="ChangeDropdowns(this.value);">

    <option value="">Select</option>

    <option value="all">Show</option>

    <option value="diff">hide</option>

</select>

 </div> 

<textarea id="text_are" name="text_are" style="display:none" > </textarea>

   </form>

</body>

</html>

Open in new window

0
 

Author Comment

by:colonelblue
ID: 33487324
Thank you. Pretty close but perhaps I should be more exact, my apologies.

 I have code here to hide a region. Depending on what the select box's value is when the region would be shown. However  the problem is when I initially select an option in the dropdown, the code to check if the region should be shown or not will only work if the page is refreshed otherwise it will not see that I changed the value in the dropdown box.

The effect I am going for is that on this form there is no reason for the "additional fields ( in a table )  to show" if it does not apply to the initially selected choice.

Thanks again!





The select box



<select distinct name="Header" id="Header">

          <option value="<%=((Recordset1.Fields.Item("Page_Header").Value))%>" selected="selected"><%=((Recordset1.Fields.Item("Page_Header").Value))%></option>

          <option value="Maintenance Notice">Maintenance Notice</option>

          <option value="Systems Down">Systems Down</option>

          <option value="All Systems Go">All Systems Go</option>

        </select>







and the hidden region:

<% if Recordset1.Fields.Item("Page_Header").Value = "Maintenance Notice" then ' Adv Conditional Region %>

  <table width="90%" height="75" border="1" cellpadding="7" cellspacing="7" id="form2">

    <tr>

      <td valign="top"><p>For Maintenance Mode

        : </p>

        <table width="381" height="105" border="1" id="form2">

          <tr>

            <td width="131"> Service Date:</td>

            <td width="234"><input name="ServiceDate" type="text" id="ServiceDate" />

              <a href="#" onclick="KW_doCalendar('ServiceDate',0)">Select Date</a></td>

            </tr>

          <tr>

            <td>Sscheduled Time</td>

            <td><input type="text" name="TimeDown" id="TimeDown" /></td>

            </tr>

          <tr>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            </tr>

          </table>

        <p> <br />

          <label for="ServiceDate"></label>

          <br />

          <label for="TimeDown"></label>

          <br />

          </p></td>

      </tr>

  </table>

  <% end if ' Recordset1.Fields.Item("Page_Header").Value = "Maintenance Notice" %>

Open in new window

0
 
LVL 18

Accepted Solution

by:
Rajar Ahmed earned 500 total points
ID: 33491619
>i am not getting fully with u .

" i gues u want to to display dat table only for maintainence without page refresh .."

>if dis is d case try this code.
>also i guess its continuation of othr question u asked which is under progess .
so i combined wt dat code itself .


Meeran03
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
    <script type="text/javascript">
function ChangeDropdowns(value){

if(value=="Maintenance Notice"){
document.getElementById('form2').style.display='block';
}
else 
{
document.getElementById('form2').style.display='none';
}

}
</script>
</head>
<body>

'The select box


<%
static_value = split("Maintenance Notice,System Down,All Systems Go",",")
sql = "select pageview from tbl1"  ' Adjust ur query 
set dr = con.execute(sql)
dim chk_duplicate
chk_duplicate = false
%>

<select distinct name="Header" id="Header" onchange="ChangeDropdowns(this.value)">
         
           <% for each static_ind in static_value%>
          <option value="<%=static_ind%>"><%=static_ind%></option>
           <%next%>
          <%
		  while not dr.eof 
		     for each static_ind in static_value
			     if  trim(static_ind) = trim(dr(0)) then 
				    chk_duplicate = true
				 end if 	
			next
			 if chk_duplicate = false then %>
			  <option value="<%=dr(0)%>"><%=dr(0)%></option>
			<% end if 
			 dr.movenext 
			 chk_duplicate = false   'Again setting the status
		  wend 	 
		  %>
          
</select>

  <div  id="form2" style="display:none">
  <table width="90%" height="75" border="1" cellpadding="7" cellspacing="7" >
    <tr>
      <td valign="top"><p>For Maintenance Mode
        : </p>
        <table width="381" height="105" border="1" id="form2">
          <tr>
            <td width="131"> Service Date:</td>
            <td width="234"><input name="ServiceDate" type="text" id="ServiceDate" />
              <a href="#" onclick="KW_doCalendar('ServiceDate',0)">Select Date</a></td>
            </tr>
          <tr>
            <td>Sscheduled Time</td>
            <td><input type="text" name="TimeDown" id="TimeDown" /></td>
            </tr>
          <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            </tr>
          </table>
        <p> <br />
          <label for="ServiceDate"></label>
          <br />
          <label for="TimeDown"></label>
          <br />
          </p></td>
      </tr>
  </table>
  </div>

Open in new window

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Random function on ASP page not working 6 55
Leverage browser caching 2 55
Css expand Div to fit its content (Of other divs) 4 45
Server Timeout with Loop 6 36
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

939 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

10 Experts available now in Live!

Get 1:1 Help Now