I am trying to fix a web/database problem (someone else wrote) and am not that familiar with Java or Ajax.
The code opens a list when data is typed in a text input field but the "onkeyup" selection is not what is written to the database.
For example: I type "Ma" in a text box. A list of names appears: "Maggie", "Margaret", "Mary". I click on "Mary" to select it and submit the page. When I check the data input in the database, "Ma" is what was input.
The code looks like this:
Expand|Select|Wrap|Line Numbers
- <html>
- <head>
- <title>User Select</title>
- …
- <script language="JavaScript" type="text/javascript" src="ajax.js"></script>
- </head>
- <form action="user_save.cfm method="post" enablecab="yes">
- <table>
- <tr><td>
- Names: <br>
- <input type="text" name="names_search" size="10" onKeyUp="xmlhttpRequest('ajax_get_names.cfm', this.value, 'names')" ><br>
- <div id="names"></div>
- </td></tr></table>
- …
Expand|Select|Wrap|Line Numbers
- <cfoutput>
- <cfif not isdefined("form.names_search")><cflocation url=""></cfif><br>
- </cfoutput>
- <cfquery name="user_save" datasource="#ds#">
- insert into dbspace.team_member
- ( member)
- value
- (
- <cfqueryparam value = "#names_search#" cfsqltype="cf_sql_varchar">
- )
- </cfquery>
Does anyone have any ideas?