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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Which is best: retain listbox variable or don't refresh? 2

Status
Not open for further replies.

birdycarolyn

Technical User
Apr 9, 2002
8
US
Hello Experts,

I'm fairly new to ASP and VBScript and would like to know if what I want to do is possible, and the best way to do it.

I present a form to the user, where they have 4 dropdown boxes to choose information from: A segment, Month, Day and Hour. The 'segment' dropdown list items are hardcoded, but the Month, day and hour dropdown boxes are populated using a variation of the following code which ensures that the the current month, day and hour are highlighted.

<code>
<SELECT NAME=&quot;SMAMonth&quot;>
<%Dim M
for M = 1 to 12
Response.Write(vbNewLine)
if M = Month(date) then
Response.Write(&quot;<OPTION selected value=&quot; & M & &quot;>&quot; &
M & &quot;</OPTION>&quot;)
else
Response.Write(&quot;<OPTION value=&quot; & M & &quot;>&quot; & M
& &quot;</OPTION>&quot;)
end if
next
%>
</SELECT>
</code>

When the user Submits the form, a table of results is displayed BELOW the form. However, when they press Submit, I use &quot;#include file&quot; to call numerous ASP files to create the web page, and in the process I refresh the form so that the options they just selected get refreshed according to the script above.

Once the table is displayed, I would like the user to be able to still use the form and make selections, but I would like their selections to be retained by the dropdown boxes. So, should I use variables somehow to save these results? Or, is there a way, when they press Submit, that I can just insert the table under the form versus refreshing everything? I hope I have made myself clear and appreciate any help.

Carolyn
 
ie u r submitting the page to itself? or r u using iframe?

Known is handfull, Unknown is worldfull
 
When the user presses submit on the form, it calls Results.asp which contains:

<code>
<!--#include file=&quot;../inc/top1.asp&quot;---> (contains functions)

<!--#include file=&quot;../inc/top2.asp&quot;---> (contains header and side menu bar)

<!--#include file=&quot;form.asp&quot;---> (contains the form)

etc....all processing code here for table layout and results
</code>

So, I guess I'm resubmitting the entire page. I don't even know what iframe is, but it sounds as if it may be helpful?>>
 
I've gone and researched IFrames and they seem to work for what I'm trying to do. However, do you know how to dynamically set the height of the IFrame because my resulting table height will always change and i'd like it completely displayed, rather than the user using scroll bars.

Thanks again!
 
there is a height clause in IFRAME if i am correct (FrameHeight=&quot;123&quot;)

Known is handfull, Unknown is worldfull
 
Here it is a simple solution. No Session Storage or Cookies.
Test.asp
....
<form action=&quot;Test.asp&quot; method=&quot;post&quot;>
<input name=v1 value=&quot;<%=Request(&quot;v1&quot;)%>
<input name=v2 value=&quot;<%=Request(&quot;v2&quot;)%>
...
<select name=_day>
<%
_day=1
if Request(&quot;_day&quot;)<>&quot;&quot; then _day=Int(Request(&quot;_day&quot;))
for i=1 to 31
%>
<option value=&quot;<%=i%>&quot; <%if i=_day then Response.Write &quot;selected&quot;%>><%=i%>
<%
next
%>
...
same for month year or anything you wish.

and now how it works.
1. First time in Test.asp
Request(&quot;v1&quot;),Request(&quot;v2&quot;)... Request(&quot;_day&quot;) will be empty so v1,v2 input text would be empty and _day would be selected on day 1
2. Second time v1 and v2 would contain the data introduced before as same as the _day select

________
George, M
 
a correction its not FrameHeight=&quot;123&quot; its Height=&quot;123&quot;

Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top