Ah, whoops.  That's what I get for not looking at all of the code.

OK, so first, you need to change your button from TYPE="submit" to
TYPE="button" and revise your goTo function as follows:

function goTo() {
    var selIdx = document.SearchForm.cbSearchSelect.selectedIndex;
    location.hash =
document.SearchForm.cbSearchSelect.options[selIdx].value;
}

The function was not being passed any parameter and it made reference to a
variable ("number") that did not seem to exist.  Also, it was not getting
the value of the currently selected select list option.  The above code
corrects these problems.

Then, change your select list's OPTION code to only include the anchor name
and not the filename as in:

<cfoutput query="gettabs">
<option value="#tablename#">#UCase(tablename)#</option>
</cfoutput>

Hopefully this will work for you.  If not, let me know what the next error
message is and we'll take it from there 8^).

--
Mosh Teitelbaum
evoch, LLC
Tel: (301) 942-5378
Fax: (301) 933-3651
Email: [EMAIL PROTECTED]
WWW: http://www.evoch.com/

-----Original Message-----
From: Eric Creese [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 12, 2003 3:36 PM
To: CF-Talk
Subject: RE: _javascript_ question

Thanks. But it did not help

In my url window I get the following

http://localhost:8500/dictionary/index.cfm?edSeachInput=personde
<http://localhost:8500/dictionary/index.cfm?edSeachInput=personde&cbSearchSe
lect=index.cfm%23PersonDemographic>
&cbSearchSelect=index.cfm%23PersonDemographic

I am expecting

http://localhost:8500/dictionary/index.cfm#PersonDemographic

-----Original Message-----
From: Mosh Teitelbaum [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 12, 2003 1:39 PM
To: CF-Talk
Subject: RE: _javascript_ question

Eric:

Instead of using location.href you should be using location.hash as in:

function goTo(url) {
location.hash = document.SearchForm.cbSearchSelect.options[number].value;
}

--
Mosh Teitelbaum
evoch, LLC
Tel: (301) 942-5378
Fax: (301) 933-3651
Email: [EMAIL PROTECTED]
WWW: http://www.evoch.com/

-----Original Message-----
From: Eric Creese [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 12, 2003 1:21 PM
To: CF-Talk
Subject: _javascript_ question

I am writing a small database data dictionary app. Since the db has over 500
tables I created a small form at the top of the page where I can start to
type in the first few letters of the tables and it will parse the list down
of available tables to choose from. Once I get the table I want, I want to
hit the go button and it will take me to the table definition lower in the
page beneath the form. The parsing piece works, the problem I am having is
trying to get the url to post correctly through the form to go down to the
part in the page the data is.

Here is my code. any ideas?

<cfquery name="gettabs" datasource="dictionary">
SELECT DISTINCT tablename FROM dictionary
ORDER BY tableName
</cfquery>

<cfquery name="getdic" datasource="dictionary">
SELECT * FROM dictionary
ORDER BY tableName,fieldname
</cfquery>

<SCRIPT LANGUAGE="_javascript_">
function goTo(url)
{
location.href = ""> }
</SCRIPT>

<SCRIPT language="_javascript_">

function searchSelectBox(in_sFormName, in_sInputName, in_sSelectName)
{
sSearchString =
document.forms[in_sFormName].elements[in_sInputName].value.toUpperCase();
iSearchTextLength = sSearchString.length;

for (j=0; j <
document.forms[in_sFormName].elements[in_sSelectName].options.length; j++)
{
sOptionText =
document.forms[in_sFormName].elements[in_sSelectName].options[j].text;
sOptionComp = sOptionText.substr(0, iSearchTextLength).toUpperCase();

if(sSearchString == sOptionComp)
{
document.forms[in_sFormName].elements[in_sSelectName].selectedIndex = j;
break;
}
}
}

</SCRIPT>

<body>

<FORM NAME="SearchForm" >
<INPUT type="text" name="edSeachInput" > searchSelectBox('SearchForm', 'edSeachInput', 'cbSearchSelect')"><BR>
<select NAME="cbSearchSelect" > <cfoutput query="gettabs">
<option value="index.cfm###tablename#">#UCase(tablename)#</option>
</cfoutput>
</select> <input type="submit" value="go" > </FORM>

<p>

<cfoutput query="getdic" group="tablename">
<table width="760" valign="top">
<tr valign="top">
<td valign="top" colspan=4><b><a
name="#tablename#">#UCase(tablename)#</a></b></td>
</tr>
<tr bgcolor="cccccc">
<td valign="top" width="30%"><font size=2>Column</font></td>
<td valign="top" width="15%"><font size=2>Data Type</font></td>
<td valign="top" width="5%"><font size=2>Size</font></td>
<td valign="top" width="50%"><font size=2>Description</font></td>
</tr>
<cfoutput>
<tr>
<td valign="top"><font size=2>#fieldname#</font></td>
<td valign="top"><font size=2>#fielddatatype#</font></td>
<td valign="top"><font size=2>#fieldlength#</font></td>
<td valign="top"><font size=2>#fielddesc#</font></td>
</tr>
</cfoutput>
<tr><td colspan=4><a href="" ><font color="red" size="1">back to
top</font></a><br>&nbsp;</td></tr>
</table>
</cfoutput>

</body>

  _____


[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to