javascript - Autocomplete/sql to fill input field 2 after onblur on input1 -
okay, here goes. have 2 input fiels. first 1 works charm, autocomplete huge database name, onblur after selecting it, should automatically fill input field 2 via php script, searches selected string in database , populates input field many hits gets. how can that?
so: if first input's autocomplete finds string, it's stored (with multiple id's on same name), should id's. if there no string found in db on first input, have autocomplete written multi selecting id's manually on second box, submitting them. not important now. again, how can populate second input given string found in database first input? far have barebone:
<input type="text" size="20" onblur"" id="firstinput" name="firstinput"> <input type="text" size="40" value="" id="manualorautogroup" name="manualorautogroup">
php json_encodes results:
$lolz = array(); while( $row = mysql_fetch_assoc($resultset) ) { $lolz[] = array( 'value' => $row['gameid'], echo json_encode($lolz); ); }
how client side code call , gets data filled input 2?
database sample:
gameid groupname
122 stringtypedininput1foundyautocomplete
314 stringtypedininput1foundyautocomplete
513 stringtypedininput1foundyautocomplete
533 stringtypedininput1foundyautocomplete
many :)
okay, here goes. have 2 input fiels. first 1 works charm, autocomplete huge database name, onblur after selecting it, should automatically fill input field 2 via php script, searches selected string in database , populates input field many hits gets. how can that? so: if first input's autocomplete finds string, it's stored (with multiple id's on same name), should id's. if there no string found in db on first input, have autocomplete written multi selecting id's manually on second box, submitting them. not important now. again, how can populate second input given string found in database first input? far have barebone: php json_encodes results: how client side code call , gets data filled input 2? database sample: gameid groupname 122 stringtypedininput1foundyautocomplete 314 stringtypedininput1foundyautocomplete 513 stringtypedininput1foundyautocomplete 533 stringtypedininput1foundyautocomplete many :) | |||
success: function(data){
, inside you'll need setsource of autocomplete
2nd input array send server. – ohgodwhy jul 7 '12 @ 0:30