Hello,
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:
The user_save.cfm code :
The ajax_get_names. cfm is a <cfquery> to a person table with <select><cfoutp ut> to get the list of names form the table.
Does anyone have any ideas?
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:
Code:
<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>
…
Code:
<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?
Comment