OutFront Forums
     Home    Register     Search      Help      Login    

Sponsors
Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax
Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.
Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Follow Us
On Facebook
On Twitter
RSS
Via Email

Recent Posts
Todays Posts
Most Active posts
Posts since last visit
My Recent Posts
Mark posts read

 

Retain the drop-down settings after the user clicks the “Submit” button.

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP, PHP, and Database >> Retain the drop-down settings after the user clicks the “Submit” button.
Page: [1]
 
 
qazwsx

 

Posts: 24
Joined: 11/14/2003
Status: offline

 
Retain the drop-down settings after the user clicks the... - 4/6/2005 14:06:49   
I am using Frontpage 2000 to build a search form to query an access database using the DRW.
I placed 6 drop down listboxes on the form to filter the display of database results on a page.
The drop down is populated by options. See the html code from 1 listbox below.
<td width="107"><p align="center"><font color="#000000"><select size="1" name="gk">
<option selected>%</option>
<option>-</option>
<option>P</option>
<option>S</option>
<option>V</option>
<option>X</option>
This Works with only one problem, the drop-down always resets itself after I click the submit button in the search form. Thus the user cannot look at the drop-down to determine the filter setting that was used to generate the database results.

How can I retain the drop-down settings after the user clicks the “Submit” button?

(The code as given in the topic “Database drop-down resets after Submit” from the author, baileywf, isn’t working in my page because his drop-down is populated by a table and not by options. )
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: Retain the drop-down settings after the user clicks... - 4/6/2005 14:37:00   
This will work only if the form posts to itself or returns with the values in form fields or querystring but this is how it's usually done:

<td width="107"><p align="center"><font color="#000000"><select size="1" name="gk">
<option selected>%</option>
<option<%IF Request("gk")="-" THEN Response.write(" selected") END IF%>>-</option>
<option<%IF Request("gk")="P" THEN Response.write(" selected") END IF%>>P</option>
<option<%IF Request("gk")="S" THEN Response.write(" selected") END IF%>>S</option>
....

That any help?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to qazwsx)
mfalk

 

Posts: 330
From: Centereach,NY
Status: offline

 
RE: Retain the drop-down settings after the user clicks... - 4/6/2005 22:21:24   
Or maybe you can do what I do sometimes. I put a header in that says:
Search Results for EMAIL ADDRESS (or whatever the search is for)..

After it I place:
<%=Request("contact_email")%>

Or any other field result you're looking for. If you're looking for name, use the name field, or date for date fields. This doesnt retain the drop down setting but places a descriptive header on the page. Instead of having to look for the dropdown, its right out in front of you.

Not sure if this exactly what you're looking for but it's actually helped show the user what they were searching for in the first place.

Mark

_____________________________

Anyone that says, "All you have to do is.."...Please leave the planet.

(in reply to qazwsx)
qazwsx

 

Posts: 24
Joined: 11/14/2003
Status: offline

 
RE: Retain the drop-down settings after the user clicks... - 4/7/2005 13:12:40   
I have tested the code you give me.
Unfortunately it didn't work.
The browser gives me a empty white page when I start it in my browser.

Do you have an idea what the problem can be.

(The form is posted to the same page as the search form.
The name of the page is search.asp and I post to search.asp.
See the code below.
<form method="POST" action="search.asp">)

Thanks in advance.


(in reply to qazwsx)
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: Retain the drop-down settings after the user clicks... - 4/7/2005 13:17:41   
quote:

<option<%IF Request("gk")="P" THEN Response.write(" selected") END IF%>>P</option>


Tha didn't work even when you're posting to the same page? Do you have a URL we can look at? If not, how 'bout all the code you use to build the menu?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to qazwsx)
qazwsx

 

Posts: 24
Joined: 11/14/2003
Status: offline

 
RE: Retain the drop-down settings after the user clicks... - 4/7/2005 13:18:22   
I have tested the code you give me.
Unfortunately it didn't work.
The browser gives me a empty white page when I start it in my browser.

Do you have an idea what the problem can be.

(The form is posted to the same page as the search form.
The name of the page is search.asp and I post to search.asp.
See the code below.
<form method="POST" action="search.asp">)

Thanks in advance.

(in reply to rdouglass)
qazwsx

 

Posts: 24
Joined: 11/14/2003
Status: offline

 
RE: Retain the drop-down settings after the user clicks... - 4/7/2005 13:28:14   
Thanks for the quick response.:)
The site is working on an Intranet at my work so I can't show what the page looks like.
I'm at home now.
I post the code of my form with the drop down list tomorrow.

(in reply to rdouglass)
qazwsx

 

Posts: 24
Joined: 11/14/2003
Status: offline

 
RE: Retain the drop-down settings after the user clicks... - 4/8/2005 15:21:55   
When I try to sent the reply with my code the following error message appears. Any idea what I'm doing wrong.

error '80020009'
Exception occurred.

/postpro.asp, line 68


I noticed that when I save the page the > at the end of the option code line is missing.

See the examples below.

Your code line
<option<%IF Request("gk")="-" THEN Response.write("selected") END IF%>>-</option>

The code line after it's saved in my page
<option<%IF Request("gk")="-" THEN Response.write("selected") END IF%>-</option>

In the example screen of frontpage the list box only shows the option selected %.
When I publish the page it's shows an empty white page.

Can the missing > be the reason that my list box only shows the option selected and the empty white page.
Any idea how I can solve these problems?

I added the code of one listbox below.

<td bgcolor="#000080" width="107"><p align="center"><select size="1" name="gk">
<option selected>%</option>
<option<%IF Request("gk")="-" THEN Response.write("selected") END IF%>-</option>
<option<%IF Request("gk")="P" THEN Response.write("selected") END IF%>P</option>
<option<%IF Request("gk")="S" THEN Response.write("selected") END IF%>S</option>
<option<%IF Request("gk")="V" THEN Response.write("selected") END IF%>V</option>
<option<%IF Request("gk")="X" THEN Response.write("selected") END IF%>X</option>



I appreciate your assistance.


(in reply to rdouglass)
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: Retain the drop-down settings after the user clicks... - 4/12/2005 13:58:02   
Can you post the current code of the DRW that is in between the "include" lines?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to qazwsx)
BeTheBall

 

Posts: 6502
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Retain the drop-down settings after the user clicks... - 4/12/2005 15:05:04   
The problem may be due to a missing space. If you compare the code rdouglass provided with yours you will notice his has " selected" where yours has "selected". The space is important. Without it, your options are written out as:

<optionselected>

You want:

<option selected>

That may also be why the closing ">" is being removed. And yes, it is necessary.

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to rdouglass)
qazwsx

 

Posts: 24
Joined: 11/14/2003
Status: offline

 
RE: Retain the drop-down settings after the user clicks... - 4/12/2005 15:50:02   
Thanks for the reply.

After I added the space the closing ">" is still being removed when I save the page.
Tomorrow, at my work, I'm going to copy and past your code in my
code and see if the closing ">" is still being removed.

I let you now if it's working or not.

The code of the DRW you asked for is added below.
The fields with the drop down lists are GK, AA, VK, BW, BES and PKM.

<%
fp_sQry="SELECT * FROM QKU00 WHERE (MAT LIKE '%::MAT::%' AND WAR LIKE '%::WAR::%' AND LAK LIKE '%::LAK::%' AND BES LIKE '%::BES::%' AND PKM LIKE '%::PKM::%' AND Compgr LIKE '%::Compgr::%' AND AA LIKE '%::AA::%' AND GK LIKE '%::GK::%' AND VK LIKE '%::VK::%' AND BW LIKE '%::BW::%' AND A LIKE '%::A::%' AND B LIKE '%::B::%' AND C LIKE '%::C::%' AND D LIKE '%::D::%' AND E LIKE '%::E::%' AND F LIKE '%::F::%' AND G LIKE '%::G::%' AND H LIKE '%::H::%' AND I LIKE '%::I::%' AND J LIKE '%::J::%' AND CA LIKE '%::CA::%' AND CB LIKE '%::CB::%' AND CC LIKE '%::CC::%' AND CD LIKE '%::CD::%' AND CE LIKE '%::CE::%' AND CF LIKE '%::CF::%' AND CG LIKE '%::CG::%' AND CH LIKE '%::CH::%' AND CI LIKE '%::CI::%' AND CJ LIKE '%::CJ::%' AND CK LIKE '%::CK::%' AND CL LIKE '%::CL::%' AND CM LIKE '%::CM::%' AND CN LIKE '%::CN::%' AND CO LIKE '%::CO::%' AND CP LIKE '%::CP::%' AND CQ LIKE '%::CQ::%' AND CR LIKE '%::CR::%' AND CS LIKE '%::CS::%' AND CT LIKE '%::CT::%' AND CU LIKE '%::CU::%' AND CV LIKE '%::CV::%' AND CW LIKE '%::CW::%' AND CX LIKE '%::CX::%' AND CY LIKE '%::CY::%' AND CZ LIKE '%::CZ::%' AND DA LIKE '%::DA::%' AND DB LIKE '%::DB::%' AND KLS LIKE '%::KLS::%')"
fp_sDefault="MAT=%&WAR=%&LAK=%&BES=%&PKM=%&Compgr=%&AA=%&GK=%&VK=%&BW=%&A=%&B=%&C=%&D=%&E=%&F=%&G=%&H=%&I=%&J=%&CA=%&CB=%&CC=%&CD=%&CE=%&CF=%&CG=%&CH=%&CI=%&CJ=%&CK=%&CL=%&CM=%&CN=%&CO=%&CP=%&CQ=%&CR=%&CS=%&CT=%&CU=%&CV=%&CW=%&CX=%&CY=%&CZ=%&DA=%&DB=%&KLS=2288"
fp_sNoRecords="<tr><td colspan=40 align=left width=""100%"">Geen kodenummers gevonden die aan uw zoekopdracht voldoen</td></tr>"
fp_sDataConn="classweb"
fp_iMaxRecords=0
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice="KOD"
fp_sMenuValue="KOD"
fp_iDisplayCols=40
fp_fCustomQuery=False
BOTID=1
fp_iRegion=BOTID
%>



(in reply to rdouglass)
qazwsx

 

Posts: 24
Joined: 11/14/2003
Status: offline

 
RE: Retain the drop-down settings after the user clicks... - 4/13/2005 14:26:47   
I can't get the closing ">" saved in my page.

I have made a test page with two search fields and one
drop-down and added your code. In that page the closng ">" is saved and the drop-down is working fine.

It seems to me that there must be a problem in the code of my page.
Do you have an idea what the cause of the problem, that I can't save the closing ">", can be.

I hope I don't have to make my page anew.

Every time I try to sent the code with a reply I receive an error.
Can it be that the code is to long to sent?

(in reply to rdouglass)
BeTheBall

 

Posts: 6502
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Retain the drop-down settings after the user clicks... - 4/13/2005 14:36:37   
quote:

Can it be that the code is to long to sent?


Maybe. Feel free to email it to me via the email link under my avatar. Just paste the code into the body of the email. If that doesn't work, let me know and I will send you a private message with my email address and you can send it as an attachment.

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to qazwsx)
qazwsx

 

Posts: 24
Joined: 11/14/2003
Status: offline

 
RE: Retain the drop-down settings after the user clicks... - 4/13/2005 14:58:39   
The email link under your avater didn't work eather.
If it's ok by you I would like to sent the code with an attachment in an e-mail.

(in reply to BeTheBall)
Spooky

 

Posts: 26723
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Retain the drop-down settings after the user clicks... - 4/13/2005 15:35:18   
<option <%IF Request("gk")="-" THEN Response.write("selected")%>>-</option>

Notice you should have 2 ">>"

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

Sp:)ky


(in reply to qazwsx)
BeTheBall

 

Posts: 6502
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Retain the drop-down settings after the user clicks... - 4/13/2005 16:10:05   
I am shocked at my finding on this. It seems your problem relates to spacing. Also, since you are going to dynamically determine which option is selected, you should not hard code the first option as selected. The fact that it is first in the list will make it appear selected when the page loads. So, change this:

<option selected>%</option>
<option<%IF Request("gk")="-" THEN Response.write("selected") END IF%>-</option>
<option<%IF Request("gk")="P" THEN Response.write("selected") END IF%>P</option>
<option<%IF Request("gk")="S" THEN Response.write("selected") END IF%>S</option>
<option<%IF Request("gk")="V" THEN Response.write("selected") END IF%>V</option>
<option<%IF Request("gk")="X" THEN Response.write("selected") END IF%>X</option>

to

<option <%IF Request.Form("gk")="%" THEN Response.write(" selected") END IF%> value="%"></option>
<option <%IF Request.Form("gk")="***" THEN Response.write(" selected") END IF%> value="-">-</option>
<option <%IF Request.Form("gk")="P" THEN Response.write(" selected") END IF%> value="P">P</option>
<option <%IF Request.Form("gk")="S" THEN Response.write(" selected") END IF%> value="S">S</option>
<option <%IF Request.Form("gk")="V" THEN Response.write(" selected") END IF%> value="V">V</option>
<option <%IF Request.Form("gk")="X" THEN Response.write(" selected") END IF%> value="X">X</option>

See the space between <option and "<%IF"? That seemed to be the problem.


_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to Spooky)
qazwsx

 

Posts: 24
Joined: 11/14/2003
Status: offline

 
RE: Retain the drop-down settings after the user clicks... - 4/14/2005 13:02:13   
Thank you for the research.
I'm going to try it tomorrow at my work.

I have a question about the first and second line of the code.
I expect it's right but just to be sure.

In the first line there is no, % , before </option> should I leave that or add a % sign?

In the second line there are three, *** , should I leave that or change it in, - ?

Thanks again for your assistance.

(in reply to BeTheBall)
BeTheBall

 

Posts: 6502
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Retain the drop-down settings after the user clicks... - 4/14/2005 13:18:20   
Go ahead and make both changes. I had changed the "-" to "***" out of curiosity. The missing "%" was an oversight on my part.

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to qazwsx)
qazwsx

 

Posts: 24
Joined: 11/14/2003
Status: offline

 
RE: Retain the drop-down settings after the user clicks... - 4/15/2005 15:02:31   
Problem solved!!!!!!

The code you gave me worked!!!
It's a gigantic improvement of my page.

Thanks for your assistance!!!

Now I need a reset button to clear the selected search options in the search fields and drop-down boxes.

I've seen the code off Lyners posted in this forum. (Reset Button)
I'm going to add it in my page. Hopefully it works.




(in reply to BeTheBall)
Page:   [1]

All Forums >> Web Development >> ASP, PHP, and Database >> Retain the drop-down settings after the user clicks the “Submit” button.
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts