Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

2 radio, 1 list box - form reload 3

Status
Not open for further replies.

bipink

Programmer
Apr 15, 2004
14
US
Hi everyone,

Please anyone suggest me how to do this:

I have 2 radio buttons. When the user clicks on 2nd radio button, a selection box (combo box) is shown. This means that first time when the page loads, the combo box is hidden. I am using style:hidden for the visibility. When user clicks on 2nd button, i make the combo box visible.
Now, on clicking the combo box the same page reloads again after doing a query on the database and displays some info.
Now my problem is that when the second time the page reloads, the combo box is hidden. This time I want it to be visible and not hidden.
Can someone suggest me how to do this ?
Thanks a lot,

Sincerely,
bipin
 
Assuming you're using a post to the same page the 2nd time around:

' If there was a post.
If Request.TotalBytes > 0 Then
...
Else
...
End If

Best regards,
J. Paul Schmidt, Freelance ASP Web Consultant
ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...
 
Hi Mr. Schmidt,

Is this a javascript function or asp ?
Because I use following in a javascript function to make the combo box visible on click of 2nd button:

document.getElementById('sArea3id').style.visibility = "visible";

How do I change it back within my ASP ?
Thanks,

Bipin
 
<<
Is this a javascript function or asp ?
>>

ASP.

Best regards,
J. Paul Schmidt, Freelance ASP Web Consultant
ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...
 
You can mix and match the ASP and Javascript:
'If there was a post.
If Request.TotalBytes > 0 Then
%>
<SCRIPT Language=Javascript>
document.getElementById('sArea3id').style.visibility = "visible";
</SCRIPT>
<%
Else
%>
<SCRIPT Language=Javascript>
document.getElementById('sArea3id').style.visibility = "hidden";
</SCRIPT>
<%
End If
Based on what was posted, you can make the object visible or hidden

 
Here's a simple example of how you could do it. Continue to use whatever function you are currently using to make the Select box visible. Create a hidden form field and post a value to the page (in this case "myFlag"). If the value is passed then it means the form was submitted. In that case you can call your function in the Body OnLoad event.

Code:
<%
ShowSelect=FALSE
if request.Form("myFlag") <> "" then
	ShowSelect=TRUE
End if
%>

<html><head><body <%if ShowSelect then%> onLoad="ShowSelect()" <%end if%>>
<form name="form1" method="POST" action="<%=request.servervariables("SCRIPT_NAME")%>">
<select name="sArea3id" style="visibility:hidden;">
<option>Option 1</option>
<option>Option 2</option>
</select>
<br>
<input name="rdo1" type="radio" value="0" onClick="ShowSelect()">
<input name="btnSubmit" type="submit" value="Submit">
<input type="hidden" name="myFlag" value="1">
</form>
</body></html>
<script language="javascript">
function ShowSelect(){
document.getElementById('sArea3id').style.visibility = "visible";
}
</script>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top