Auto Fill (auto search)


Two files important for it

1 -?jquery-ui.css

2-jquery-ui.min.js

you can get these two files in?gabrielli admin js,css

//////////////////////////////// css code??//////////////////////////////////////////////////////

<style>
.ui-autocomplete {
max-height:400px;
max-width: 375px;
overflow-y: auto;
overflow-x: hidden;
padding-right: 20px;
font: 11px Verdana, sans-serif;
}
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus{
color:inherit;
border:1px solid gray;
background:#E4E4E4;
}
/* IE 6 doesn't support max-height
* we use height instead, but this forces the menu to always be this tall
*/
* html
.ui-autocomplete {
height: 400px;
}
</style>

///////////////////////////// End Css //////////////////////////////////////////////////////////

/////////////////////////////// Jquery ////////////////////////////////////////////////////////

$(document).ready(function() {
/////////////////////// Auto complete search ///////////////////////////////////
$(".model").live("focus", function() {
//alert(frontend_url+"auto_complete_search.php");
var id = $(this).parent().parent().attr('id');
$(".model").autocomplete({
source: frontend_url+"admin_auto_complete_search.php",
delay: 0,
minLength:3,
select: function (event, ui) {
var productNameUrl = ui.item.value;
var productId = ui.item.id;
var is_flag = (ui.item.flag);
if(is_flag){
$(this).val(ui.item.sku);
$("#"+id).children().children('.description').val(ui.item.p_name);
//$(this).parent.child(".description").val(ui.item.p_name);
}
}

});
});

});
////////////////////////////////////////////////////////////////////////////////

////////////////////////////////// End Jquery //////////////////////////////////////////////////

/////////////////////////////////// Php code /////////////////////////////////////////////////

<tr id="row_<?=$i;?>">
<td><input type="text" name="model[]" class="model" /><td>
<td><input type="text" name="description[]" class="description" /><td>
<td><input type="text" name="quantity[]" /><td>
<td><input type="text" name="price[]" /><td>
<td><?=number_format(0,2);?><td>
</tr>

/////////////////////////////////////// End php code ////////////////////////////////////////

Leave a Reply

Your email address will not be published. Required fields are marked *