Fixed Trac #307: prevent form submission when the value typed into an autocomplete field does not correspond to a valid value.

SVN:trunk[930]
This commit is contained in:
Denis Flaven
2010-10-26 08:12:31 +00:00
parent 05a2443afe
commit 0b95b3799e
3 changed files with 30 additions and 3 deletions

View File

@@ -1128,7 +1128,7 @@ EOF
$sHTMLValue .= "<input type=\"hidden\" id=\"$iId\" name=\"attr_{$sFieldPrefix}{$sAttCode}{$sNameSuffix}\" value=\"$value\" />\n";
$oPage->add_ready_script("\$('#label_$iId').autocomplete('./ajax.render.php', { scroll:true, minChars:3, onItemSelect:selectItem, onFindValue:findValue, formatItem:formatItem, autoFill:true, keyHolder:'#$iId', extraParams:{operation:'autocomplete', sclass:'$sClass',attCode:'".$sAttCode."'}});");
$oPage->add_ready_script("\$('#label_$iId').blur(function() { $(this).search(); } );");
$oPage->add_ready_script("\$('#label_$iId').result( function(event, data, formatted) { if (data) { $('#{$iId}').val(data[1]); $('#{$iId}').trigger('change'); } else { $('#{$iId}').val(''); $('#{$iId}').trigger('change');} } );");
$oPage->add_ready_script("\$('#label_$iId').result( function(event, data, formatted) { OnAutoComplete('$iId', event, data, formatted); } );");
$aEventsList[] ='change';
}
else