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