Paging rdouglas (Full Version)

All Forums >> [Web Development] >> ASP, PHP, and Database



Message


John316 -> Paging rdouglas (10/3/2002 9:15:04)

1) I have created a session in my global.asa file, my question is if I remove the global.asa will there be a time limit on my webpage. since A session ends if a user has not requested or refreshed a page in the ASP application for a specified period. By default, this is 20 minutes. So my thinking is if I remove my globl.asa file from the webpages it will also remove the time limit, will this work? I have already tried to increase the Session Timeout to equal (Session.Timeout=500) but nothing I try has worked so if I remove my global.asa hopefully it will no long kick people out of my database after 20 minutes. So will this work?


2) I have created a web form with drop down menu' s. After the web form is save and you leave the page or even refresh the page it also resets the drop down menu. Is there a way to stop that?




Spooky -> RE: Question: global.asa, sessions and Dropdown menus (10/3/2002 9:31:22)

I would keep the asa file, but perhaps specify session.timeout in the session on_start.
Im hesitant in extending that by too many minutes as it is a known resource hog. Dont go past 30 minutes if possible

To maintain state on a select list, youll need to make the option " selected" based on user input:
http://www.frontpagewebmaster.com/tm.asp?m=93278&p=1&tmode=1




John316 -> RE: Question: global.asa, sessions and Dropdown menus (10/3/2002 11:00:55)

Spooky,

How would I write a session timeout? and where would I place it on the Webpage. In the Begin, <head>, or <body>?

John 316




Spooky -> RE: Question: global.asa, sessions and Dropdown menus (10/3/2002 11:13:41)

You can specify it anywhere - obviously it will be global if placed in the asa file.
If a user doesnt surf to a page based variable, it wont take effect.

<%Session.Timeout=20%>

20 is the normal default server setting.




John316 -> RE: Spooky or hhammash (10/23/2002 11:41:01)

Spooky or hhammash,

can one of you please help me, I have created a web form with drop down menu' s. After the web form is save and you leave the page or even refresh the page it also resets the drop down menu. Is there a way to stop this?

John316




hhammash -> RE: Question: Need HELP (10/23/2002 17:38:33)

Hi,

Do you mean that when you select an option from the drop down menu and then refresh the page it resets the drop to the default value?

If yes, I get rid of this by having a two frames page (top and bottom) I keep the drop down menu serach field on the top frame and display the results in the bottom one, the results get displayed and the drop down keeps the selected option.

Or by having a page with InlineFrame, I keep the drop down on the page and display the results in an InlineFrame (iFrame).

Spooky might be able to help you using code.

Regards
Hisham




John316 -> Calling Spooky (10/27/2002 19:13:14)

Spooky can you help with this problem?

John316




Spooky -> RE: Calling Spooky (10/27/2002 19:38:11)

Can you give me an example of why and when you would return to a form?
My initial response would be to save the form values to a session or cookie.

It depends on the form use.




John316 -> RE: Calling Spooky (10/29/2002 10:50:01)

Spooky and hhammash,

On the Below URL you gave some advice on how to maintain state on a select list, here is that URL ( http://www.frontpagewebmaster.com/tm.asp?m=93278&p=1&tmode=1 ). If my code is Currently this:

<select name=" DropDownList1" size=" 5" multiple>
<option>DropdownItem1</option>
<option>DropdownItem2</option>
<option>DropdownItem3</option>
<option>DropdownItem4</option>
<option>DropdownItem5</option>
</select>

How would I make it equal to the code on the URL above?

John316




hhammash -> RE: Spooky, hhammash or anyone please help me (10/29/2002 10:59:52)

Hi John,

No that link looks different.

It was about passing the value selected to the destination page.

Your matter is different.


Regards
Hisham




John316 -> RE: Spooky, hhammash or anyone please help me (10/29/2002 11:02:22)

Sorry about that hhammash

John316




hhammash -> RE: Spooky, hhammash or anyone please help me (10/29/2002 11:26:31)

Hi John,

Are you using a drop down box on the DRW itself?

Check this and let me know if this is what you need?

Select and Option and press the button:

http://www.fmhs.uaeu.ac.ae/nml/Booking/DropList2.asp

Regards
Hisham




John316 -> RE: Spooky, hhammash or anyone please help me (10/29/2002 13:32:37)

hhammash,

It is almost exactly what I am looking for, the only difference is on your first page I have my drop down menu as a list and allow multiple selections. I tried to do this with your code and it did not work.


John316




hhammash -> RE: Spooky, hhammash or anyone please help me (10/30/2002 0:12:28)

Hi,

I t hink you need to use " IN" in the sql and you have to make the selection box as an Array to be able to hold more than one value.

I think either Spooky or rdouglas can handle that.

It is a FAQ now, I hope that they solve it.

I' ll try my books and see if I can help.

Regards
Hisham




hhammash -> RE: Spooky, hhammash or anyone please help me (10/30/2002 3:32:03)

Hi,

Try this if your search field is numeric

<%
fp_sQry=" SELECT * FROM Table WHERE FieldName IN (" &MultiSelectField&" )"


For text you have to use the Replace function, I still don' t know how, may be Spooky or rdouglas can help.

Hisham




John316 -> RE: Spooky, hhammash or anyone please help me (10/30/2002 11:51:39)

Spooky or rdouglas,

If you look at this URL (http://www.fmhs.uaeu.ac.ae/nml/Booking/DropList2.asp ) provided by hhammash why is it that the drop down menu will not save the value once you submit it, or try to view it on the next page or even refresh the page?

John316




hhammash -> RE: Paging Spooky or rdouglas (10/30/2002 12:00:15)

Hi John,

I chagned the code, it saves now, but the problem It can' t search mutliple because it is not numeric, as I have stated in my previous post.

Try it now.

Wee need Spooky or rdouglas for help on making multiple search on alphanumeric using the &FieldName&.


Regards
Hisham




rdouglass -> RE: Paging Spooky or rdouglas (10/31/2002 8:18:34)

I have never tried retaining the values of a multi-select drop down but I' ve read the values and manipulated them using arrays. I' m sorry - I' ve been real tied up and havent had a chance to get here often.

However, this is how I' d deal with the multiple values - something like this:

<%DIM myArray, myString
myString = Request.Form(" myMultiSelectDropDown" )
myArray = split(myString, " ," )

FOR i = 0 to UBound(myArray)
' I always trim my array data just for good practice
myArray(i) = trim(myArray(i))%>

(Whatever code you want to do)

<%NEXT%>

I am not sure if this helps or not, but that is generally how I' d handle it. If you could be more specific - post your code and show an example (of one that actually does it) maybe??

EDIT: OOPS! You did provide an example[:o]. I see that your using dates. I dunno' how that will work with dates. I' ll test it and get back. Also, you want to retain all the selected dates in the menu? I see you have it working with one (adding it to the end of the list)...




John316 -> RE: Paging Spooky or rdouglas (10/31/2002 9:17:13)

all,

Please read Hisham statement above. Can any of you help?

Thanks,
John316




John316 -> RE: Paging Spooky or rdouglas (10/31/2002 9:19:33)

rdouglass,

My website is now setup to look excatly like this http://www.fmhs.uaeu.ac.ae/nml/Booking/DropList2.asp


John316




rdouglass -> RE: Paging Long Island Lune, bobby, Spooky and rdouglas (10/31/2002 9:28:05)

I' m pretty sure I can build this code. 2 questions:

What happened to the multiselect dropdown?

What is the data type in the DB: text or dates?




John316 -> RE: Paging Long Island Lune, bobby, Spooky and rdouglas (10/31/2002 9:36:02)

it was taken off since it did not work. and my data type is text

John316




rdouglass -> RE: Paging Long Island Lune, bobby, Spooky and rdouglas (10/31/2002 10:22:04)

Well here is my solution using dates and multi-select dropdowns. On the results page (the page you' re posting to) put code like this ABOVE the DRW:

<%DIM mySQL, stringTemp, arrayTemp
mySQL = " "
stringTemp = Request.Form(" EntryDate" )
arrayTemp = split(stringTemp," ," )

For i = 0 to (UBound(arrayTemp)-1)
mySQL = mySQL & " EntryDate = #" & trim(arrayTemp(i)) & " # OR "
NEXT
mySQL = mySQL & " EntryDate = #" & trim(arrayTemp(UBound(arrayTemp))) & " #"
%>

Then change your DRW query line to something like this:

fp_sQry=" SELECT * FROM Messages WHERE (" & mySQL & " )"

This does work for me and my DB. You will probably need to change the table name (mine is " Messages" ) and the Request.Form and fieldname items (mine here is " EntryDate" ), but this should work. Also, you' ll need to remove the ' #' s from the code above if you' re using text. You may or may not have to replace them with a ' . I suspect not, but if it doesn' t work without ' em, put ' em in...[:D]

Hope this helps...




John316 -> RE: Paging Long Island Lune, bobby, Spooky and rdouglas (10/31/2002 10:54:02)

Question: what does DRW stand for? and will your code work for normal text fields also?

John316




rdouglass -> RE: Paging Long Island Lune, bobby, Spooky and rdouglas (10/31/2002 11:25:44)

DRW stands for " Database Results Wizard" and yes, it should work for text fields. However; you' ll either have to replace the " #" with a single quote (for a text delimiter) or you' ll have to remove them entirely - I haven' t tested it - but the theory remains the same.....




John316 -> RE: Paging Long Island Lune, bobby, Spooky and rdouglas (10/31/2002 13:54:35)

rdouglass,

It seems to work with dates, but how would I get it to work with text?

John316




rdouglass -> RE: Paging Long Island Lune, bobby, Spooky and rdouglas (10/31/2002 14:50:15)

Again, I haven' t tested with text so it' s either:


<%DIM mySQL, stringTemp, arrayTemp
mySQL = " "
stringTemp = Request.Form(" EntryDate" )
arrayTemp = split(stringTemp," ," )

For i = 0 to (UBound(arrayTemp)-1)
mySQL = mySQL & " EntryDate = ' " & trim(arrayTemp(i)) & " ' OR "
NEXT
mySQL = mySQL & " EntryDate = ' " & trim(arrayTemp(UBound(arrayTemp))) & " ' "
%>

OR

<%DIM mySQL, stringTemp, arrayTemp
mySQL = " "
stringTemp = Request.Form(" EntryDate" )
arrayTemp = split(stringTemp," ," )

For i = 0 to (UBound(arrayTemp)-1)
mySQL = mySQL & " EntryDate = " & trim(arrayTemp(i)) & " OR "
NEXT
mySQL = mySQL & " EntryDate = " & trim(arrayTemp(UBound(arrayTemp)))
%>

See, I' m just working with the delimiters:[:)]

# delimits Dates
' delimits text
(don' t use delimiters for numbers)

See here for more delimiters




John316 -> RE: Paging Long Island Lune, bobby, Spooky and rdouglas (11/15/2002 11:02:21)

rdouglas,

My code is working and I am listing it below, Here is my question: The Request.Query command will only work for the drop down when the input is from the previously visited page. It basically grabs the data from the previous page and uses it to modify the drop down menu. It does not touch the database at all. If I would like the drop down to be database-driven, I will need to change the Request.Query command to a different variable. This variable I think would come from my Session object retrieved from the database would you know how to do this?

John316


<html>

<head>
<meta http-equiv=" Content-Type" content=" text/html; charset=windows-1252" >
<meta name=" GENERATOR" content=" Microsoft FrontPage 4.0" >
<meta name=" ProgId" content=" FrontPage.Editor.Document" >
<title>New Page 1</title>
</head>

<body>

<form action=test1.asp method=" get" >
<%
For i = 1 to Request.QueryString(" position" ).Count
if Request.QueryString(" position" )(i)=" 1" then choice1=" yes"
if Request.QueryString(" position" )(i)=" 2" then choice2=" yes"
if Request.QueryString(" position" )(i)=" 3" then choice3 =" yes"
Next

%>
<p><select size=" 3" name=" position" multiple>
<option value=" 1" <%if instr(choice1, " yes" ) then response.write(" SELECTED" )%>>Choice 1</option>
<option value=" 2" <%if instr(choice2, " yes" ) then response.write(" SELECTED" )%>>Choice 2</option>
<option value=" 3" <%if instr(choice3, " yes" ) then response.write(" SELECTED" )%>>Choice 3</option>
</select><input type=" submit" value=" Submit" name=" B1" ><input type=" reset" value=" Reset" name=" B2" ></p>
</form>

</body>

</html>




rdouglass -> RE: Paging rdouglas (11/15/2002 11:19:44)

You could use a session, but I' m not sure I would. You may want to consider changing it to Request.Form and use hidden fields along the way. Your code could look something like:

<%
For i = 1 to Request.Form(" position" ).Count
if Request.Form(" position" )(i)=" 1" then choice1=" yes"
if Request.Form(" position" )(i)=" 2" then choice2=" yes"
if Request.Form(" position" )(i)=" 3" then choice3 =" yes" %>

<input name=" position<%=i%>" type=" hidden" value=" <%=Request.Form(" position" )(i)%>" >

<%
Next
%>

If we use the hidden form field, we can pass it along as many times as we need to. Does that make sense at all??

If you still want / need to use sessions, the general format for a session is:

<%Session(" mySessionName" ) = myValue%>

and to read it:

<%=Session(" mySessionName" )%>




John316 -> RE: Paging rdouglas (11/15/2002 13:57:38)

So if I wanted to use a Sessio, how would I use it with this example?

John316




Page: [1] 2   next >   >>

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.078125