news
Wed Jul 21 11:54:07 CDT 2004
The problem is that when you have a change of make, the "current"
model should be the first one for the new make, and not the one the
visitor previously selected.
Similarly, on a change of model, the "current" year should be the
first one for the new year, and not the previously-selected (and
submitted) one.
So, the criteria for the main listing may not always be those that the
visitor submits. And you have to make that decision on the server,
because the browser doesn't know what the first model for the new make
is going to be, or the first year for the new model.
Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Office FrontPage 2003 Inside Out
||---------------------------------------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------
code on the server has look up models before it knows whether to make
teh current selection
"SoniaC" <soncci@hotmail.com> wrote in message news:<#pYjE#qbEHA.1248@TK2MSFTNGP11.phx.gbl>...
> Thanks again Jim for your answer.
> I would love to be able to write the ASP from scratch. But I have no time to
> learn everything I need.
> That's why I use Front Page and try to modify the codes.
>
> Anyway, I put your Persisting Selection code at the end of the page; one
> script for each drop-down list but it seams to do nothing.
> I even put the scripts before the </body>, after it, and even try to paste
> the three scripts after the </html> but when I saved the page, FP
> automatically move those up.
>
> I asked some people at the office to try out the page and they think it is
> OK, because the main listing reset when there are no records available. So
> the information is the right one. Only people with some knowledge about cars
> and these parts are going to use the site.
>
> I know that there should be a way to reset the drop-down list "Model" and
> "Year", when "Make" changes and reset he drop-down list "Year" when "Make"
> and "Model" change.
> I need to tell the form to do that.
>
> Is there any way, command, script etc. that help me to do what I mentioned
> before using the page that I have now?
>
> Thank you for all your help and advise.
>
> SoniaC
>
>
> "Jim Buyens" <news@interlacken.com> wrote in message
> news:36a7e008.0407201325.54709a2f@posting.google.com...
> > I don't think you're using the correct method to persist the selection
> > in the drop-down lists box, and that's why you're getting doubled-up
> > values.
> >
> > You should be using the first method I mentioned at
> >
> > Persisting the Selection in a Drop-Down Box
> >
http://www.interlacken.com/winnt/tips/tipshow.aspx?tip=49
> >
> > which is to add one script such as the following, at the bottom of the
> > page, for each drop-down list box.
> >
> > <script>
> > for (i = 0; i < document.forms[0].myfield.options.length - 1; i++) {
> > if (document.forms[0].myfield.options[i].value ==
> > "<%=request("myfield")%>"){
> > document.forms[0].myfield.selectedIndex = i;
> > break;
> > }
> > }
> > </script>
> >
> > Even this is going to be a little bit squirrelly, however, because if
> > Chevrolet Caprice is already selected, and then you change Make to
> > Ford, the script is will try to default the second drop-down box value
> > to Caprice (the most recent value).
> >
> > The value Caprice won't be available for Ford, however, and so the box
> > will default to the first entry in the list, which is Aspire.
> >
> > The main listing, however, will still try to look up Ford Caprice,
> > because that's the most recent value received as form input. This will
> > produce an empty listing even though may be, in fact, records for Ford
> > Aspire.
> >
> > I'm not sure there's a good solution for this other than (1) putting
> > the selection form and the listing on different Web pages or (2)
> > coding all the ASP code from scratch.
> >
> > Jim Buyens
> > Microsoft FrontPage MVP
> >
http://www.interlacken.com
> > Author of:
> > *----------------------------------------------------
> > |\---------------------------------------------------
> > || Microsoft Office FrontPage 2003 Inside Out
> > ||---------------------------------------------------
> > || Web Database Development Step by Step .NET Edition
> > || Microsoft FrontPage Version 2002 Inside Out
> > || Faster Smarter Beginning Programming
> > || (All from Microsoft Press)
> > |/---------------------------------------------------
> > *----------------------------------------------------
> >
> >
> > "SoniaC" <soncci@hotmail.com> wrote in message
> news:<#20ub6abEHA.4092@TK2MSFTNGP11.phx.gbl>...
> > > Almost done!
> > >
> > > I followed Jim's instruction with the codes and got what I was looking
> for.
> > > Except for a small detail.
> > >
> > > When you make the first search, everything is perfect. I am using only
> one
> > > page for the three drop down boxes and the query table.
> > >
> > > But, when you re-select the choices (Make, Model) the drop down boxes
> > > re-query, yes, but they keep the first set of values until you reselect
> all
> > > of them.
> > > You can see it at:
http://www.futuraair.com/newtest3byyear.asp
> > >
> > > An example:
> > >
> > > Fist selection
> > >
> > > Make: Acura
> > > Model:Legend
> > > Year:1993 then we have the table with the results. Perfect!
> > >
> > > On this same page, change Year: 1995....no problem. Also Great!
> > >
> > > But, change Model to VIGOR and take a look at the Year Drop Box, it
> keeps
> > > the 1995 value from the first search, even though there are not 1995
> records
> > > for Vigor.
> > >
> > > If you change Make, it happens the same thing with Model and Year. The
> drop
> > > down boxes repopulate but they keep the first value.
> > >
> > > Question: How could I reset the drop down boxes Model and year when the
> new
> > > search is done?
> > >
> > >
> > > "Jim Buyens" <news@interlacken.com> wrote in message
> > > news:2e58201c46ce7$b64f6c00$a601280a@phx.gbl...
> > > > I'm not 100% sure how you're creating the first drop-down
> > > > list, but I suspect you're using the Database Results
> > > > Wizard. If so, achieving what you want is going to be
> > > > rather convoluted.
> > > >
> > > > First, sue the Wizard to create three drop-down boxes:
> > > > Make, Model, and Year.
> > > >
> > > > o When you set up the Model drop-down box, use the
> > > > value of the Make form field as a criteria.
> > > > o When you set up the Year drop-down box, use the
> > > > value of both the Make and Model form fields as
> > > > a criteria.
> > > >
> > > > The next problem is the DRW doesn't create drop-down
> > > > boxes that preserve their value. So, when the visitor
> > > > submits the form, all three drop-down boxes default to
> > > > the top selection. To fix this, refer to:
> > > >
> > > > Persisting the Selection in a Drop-Down Box
> > > >
http://www.interlacken.com/winnt/tips/tipshow.aspx?tip=49
> > > >
> > > > Next, you want the form to submit automatically whenever
> > > > the visitor changes the selection in any drop-down box.
> > > > In an ordinary drop-down box, you could achieve this by
> > > > adding an onchange= attribute. But if you try the same
> > > > thing in a DRW-generated drop-down box, the DRW will
> > > > clobber your change every time you run the wizard. So
> > > > instead, and an onload= attribute to the <body> like this:
> > > >
> > > > <body onload="initHandlers();">
> > > >
> > > > and then add scripting such as the following to the
> > > > <head> section:
> > > >
> > > > <script>
> > > > function initHandlers(){
> > > > document.forms[0].Make.onchange = Make_onchange;
> > > > document.forms[0].Model.onchange = Model_onchange;
> > > > document.forms[0].Year.onchange = Year_onchange;
> > > > }
> > > > function Make_onchange(){
> > > > document.forms[0].submit();
> > > > }
> > > > function Model_onchange(){
> > > > document.forms[0].submit();
> > > > }
> > > > function Year_onchange(){
> > > > document.forms[0].submit();
> > > > }
> > > > </script>
> > > >
> > > > The final problem involves getting the form to submit to
> > > > itself when the visitor changes a drop-down box
> > > > selection, but submit to your query page when the visitor
> > > > clicks the Submit button.
> > > >
> > > > One solution is not to use a separate query page; just
> > > > put your query DRW on the same page as the drop-down
> > > > boxes.
> > > >
> > > > Otherwise change your Submit button from
> > > >
> > > > <input type="submit" value="Submit" name="btnSub"?
> > > >
> > > > to
> > > >
> > > > <input type="button" value="Submit" name="btnSub"
> > > > onclick="document.forms[0].action='query.asp';
> > > > document.forms[0].submit();">
> > > >
> > > > where query.asp is the name of your query page.
> > > >
> > > > Well, I told you this was going to be rather convoluted.
> > > > To my mind, if you can do all this, you can probably
> > > > write an ASP or ASP.NET page from scratch that does the
> > > > same thing, and it'll be easier to debug and maintain.
> > > > But the choice is yours.
> > > >
> > > > If, in fact, you *are* writing your own ASP or ASP.NET
> > > > page, then please post again, explain how you're going
> > > > about this, and and ask a more precise question.
> > > >
> > > > Jim Buyens
> > > > Microsoft FrontPage MVP
> > > >
http://www.interlacken.com
> > > > Author of:
> > > > *----------------------------------------------------
> > > > |\---------------------------------------------------
> > > > || Microsoft Office FrontPage 2003 Inside Out
> > > > ||---------------------------------------------------
> > > > || Web Database Development Step by Step .NET Edition
> > > > || Microsoft FrontPage Version 2002 Inside Out
> > > > || Faster Smarter Beginning Programming
> > > > || (All from Microsoft Press)
> > > > |/---------------------------------------------------
> > > > *----------------------------------------------------
> > > >
> > > > >-----Original Message-----
> > > > >I was able to create three drop down boxes to search on
> a table and finally
> > > > >get the results on another page. The web address is
> > > > >
http://www.futuraair.com/AppliCat1byyear.asp
> > > > >
> > > > >What I want to do now is to have the three drop down
> boxes on the same page.
> > > > >Select the first box , which will submit to the same
> page populating the
> > > > >second box, keeping the choices open and the selected
> value on the box.
> > > > >(This is done)
> > > > >
> > > > >Then select the second box which will submit to the same
> page populating the
> > > > >third box, keeping the choices open for box 1 and 2 and
> the selected value
> > > > >on both boxes. (here begin my problem)
> > > > >
> > > > >Finally select the third box and get the table results.
> This I know must be
> > > > >in another page.
> > > > >But I want to have on the final page the three drop down
> boxes with all the
> > > > >choices available in a way that if I want to re-query
> from the beginning I
> > > > >can do it from there.
> > > > >
> > > > >I got to the first part as you can see it at the
> following address
> > > > >
http://www.futuraair.com/test1byyear.asp
> > > > >
> > > > >but when I select the second box, the first box loose
> the value and the
> > > > >third box will not populate.
> > > > >
> > > > >Is this possible with asp or I need to go with Java?
> > > > >
> > > > >Any help will be appreciated.
> > > > >
> > > > >Thanks
> > > > >
> > > > >
> > > > >.
> > > > >