Fix: auto fill zip and town with jquery
This commit is contained in:
parent
d56694c11e
commit
895fd7b6dd
@ -137,19 +137,17 @@ function ajax_autocompleter($selected='',$htmlname,$url,$option='')
|
||||
function ajax_autocompleter_ziptown($selected='',$field1,$field2,$field3,$url,$option='')
|
||||
{
|
||||
$script='';
|
||||
|
||||
//$script.= '<input type="hidden" name="'.$field1.'" id="'.$field1.'" value="'.$selected.'" />';
|
||||
|
||||
$script.= '<script type="text/javascript">';
|
||||
$script.= 'jQuery(document).ready(function() {
|
||||
//jQuery("input#'.$field1.'").blur(function() {
|
||||
jQuery("input#'.$field1.'").blur(function() {
|
||||
//console.log(this.value.length);
|
||||
//if (this.value.length == 0)
|
||||
//{
|
||||
// jQuery("#'.$field1.'").val("");
|
||||
// jQuery("#'.$field2.'").val("");
|
||||
//}
|
||||
//});
|
||||
if (this.value.length == 0)
|
||||
{
|
||||
jQuery("input#'.$field1.'").val("");
|
||||
jQuery("input#'.$field2.'").val("");
|
||||
}
|
||||
});
|
||||
jQuery("input#'.$field1.'").autocomplete({
|
||||
source: function( request, response ) {
|
||||
jQuery.get("'.$url.($option?'?'.$option:'').'", { '.$field1.': request.term }, function(data){
|
||||
@ -157,7 +155,6 @@ function ajax_autocompleter_ziptown($selected='',$field1,$field2,$field3,$url,$o
|
||||
if (data.length == 1) {
|
||||
jQuery("input#'.$field1.'").val(item.value);
|
||||
jQuery("input#'.$field2.'").val(item.field2);
|
||||
//jQuery("#search_'.$field2.'").val(item.field2);
|
||||
if (item.field3 > 0) {
|
||||
jQuery("#'.$field3.'").val(item.field3);
|
||||
}
|
||||
@ -176,11 +173,9 @@ function ajax_autocompleter_ziptown($selected='',$field1,$field2,$field3,$url,$o
|
||||
select: function( event, ui ) {
|
||||
jQuery("input#'.$field1.'").val(ui.item.value);
|
||||
jQuery("input#'.$field2.'").val(ui.item.field2);
|
||||
//jQuery("#search_'.$field2.'").val(ui.item.field2);
|
||||
if (ui.item.field3 > 0) {
|
||||
jQuery("#'.$field3.'").val(ui.item.field3);
|
||||
}
|
||||
//alert(ui.item.field2);
|
||||
}
|
||||
});
|
||||
});';
|
||||
|
||||
@ -125,8 +125,8 @@ else
|
||||
}
|
||||
$soc->address = $_POST["adresse"];
|
||||
$soc->adresse = $_POST["adresse"]; // TODO obsolete
|
||||
$soc->cp = $_POST["cp"];
|
||||
$soc->ville = $_POST["ville"];
|
||||
$soc->cp = $_POST["cp"]?$_POST["cp"]:$_POST["zipcode"];
|
||||
$soc->ville = $_POST["ville"]?$_POST["ville"]:$_POST["town"];
|
||||
$soc->pays_id = $_POST["pays_id"];
|
||||
$soc->departement_id = $_POST["departement_id"];
|
||||
$soc->tel = $_POST["tel"];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user