I am in a catch 22 with the database results tool

  • Thread starter Thread starter Mark Sandfox
  • Start date Start date
M

Mark Sandfox

I have tried every scenario I can think of but keep coming up with the same
problem.



Project = Create a database query page with 2 dropdowns for criteria and a
simple database results section for the results. The problem lay in that
the first dropdown contains a list of selections for the user to chose their
location (ie city). This dropdown contains the City for display and a
combined field of Latitude and Longitude for the city's center point. I had
to combine the lat & long because the dropdown only supports one hidden
value. (note: the other dropdown is straight forward and does not need
anything). So once the user has selected the City and then the Distance
(the other dropdown) they should click "GET" and receive a list of **** in
their area. But what happens is they have to click it twice to get the
proper list. I am sure this is because the code has to break apart the
LatLong field and apply(calculate) it to the HighLat, LowLat, HighLong and
LowLong which are hidden fields in the search form. I have tried putting
the formula directly in the form's hidden fields and have tried to VB Script
at the top of the form, then apply it to the form's hidden fields. The VB
Script does it's job correctly and when it is supposed to but the Form's
Hidden Fields DO NOT update on submit, only upon reentry. The only reason I
am using Hidden Form Fields is that FP does not want to except (by any
convention I know of) VB Script Variables in either SQL Custom query or the
Form's Criteria area. I am at a complete loss on this one. Any help you
can throw my way would be greatly appreciated.

Thank you,
Mark
 
I take it all this so you can front-end the Database
Results Wizard. The same thing wouldn;t be very difficult
at all if you were writing your own ASP or ASP.NET code
(except, of course, that you would have to write that
code).

Anyway, I think you would have more luck using JavaScript
to split out the Latitude and Longitude on the browser. To
do this, first replace the Submit button with an ordinary
pushbutton like this:

<input type="button" value="Submit" name="btnSub"
onclick="prepSubmit();">

Note the onclick= attribute, which calls a JavaScript
function. Assuming your drop-down box is:

<select size="1" name="ddlCity">
<option value="51n29,0e0">Greenwich</option>
<option value="19n34,154w53">Honolulu</option>
<option value="35n42,139e46">Tokyo</option>
</select>

and the hidden form fields are:

<input type="hidden" name="hidLat">
<input type="hidden" name="hidLng">

the prepSubmit() function would look something like:

<script>
function prepSubmit(){
vals = document.forms[0].ddlCity.value.split(",");
document.forms[0].hidLat.value = vals[0];
document.forms[0].hidLng.value = vals[1];
document.forms[0].submit();
}
</script>

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Office FrontPage 2003 Inside Out
|| Microsoft FrontPage Version 2002 Inside Out
|| Web Database Development Step by Step .NET Edition
|| Troubleshooting Microsoft FrontPage 2002
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------
 
Back
Top