Doxygen
This commit is contained in:
parent
5738d6de98
commit
0ccd29c6cd
@ -25,8 +25,9 @@
|
||||
|
||||
|
||||
/**
|
||||
* Get value of an HTML field, do Ajax process and show result.
|
||||
* Generic function that return javascript to add to a page to transform a common input field into an autocomplete field by calling an Ajax page (ex: /societe/ajaxcompanies.php).
|
||||
* The HTML field must be an input text with id=search_$htmlname.
|
||||
* This use the jQuery "autocomplete" function.
|
||||
*
|
||||
* @param string $selected Preselecte value
|
||||
* @param string $htmlname HTML name of input field
|
||||
@ -34,7 +35,7 @@
|
||||
* @param string $urloption More parameters on URL request
|
||||
* @param int $minLength Minimum number of chars to trigger that Ajax search
|
||||
* @param int $autoselect Automatic selection if just one value
|
||||
* @param array $ajaxoptions Multiple options array (Ex: array('update'=>array('field1','field2'...)) will reset field1 and field2 once select done
|
||||
* @param array $ajaxoptions Multiple options array (Ex: array('update'=>array('field1','field2'...)) will reset field1 and field2 once select done)
|
||||
* @return string Script
|
||||
*/
|
||||
function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLength=2, $autoselect=0, $ajaxoptions=array())
|
||||
@ -182,25 +183,28 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
|
||||
}
|
||||
|
||||
/**
|
||||
* Get value of field, do Ajax process and return result
|
||||
* Generic function that return javascript to add to a page to transform a common input field into an autocomplete field by calling an Ajax page (ex: core/ajax/ziptown.php).
|
||||
* The Ajax page can also returns several values (json format) to fill several input fields.
|
||||
* The HTML field must be an input text with id=$htmlname.
|
||||
* This use the jQuery "autocomplete" function.
|
||||
*
|
||||
* @param string $htmlname Name of field
|
||||
* @param string $fields other fields to autocomplete
|
||||
* @param string $url Chemin du fichier de reponse : /chemin/fichier.php
|
||||
* @param string $htmlname HTML name of input field
|
||||
* @param string $fields Other fields to autocomplete
|
||||
* @param string $url URL for ajax request : /chemin/fichier.php
|
||||
* @param string $option More parameters on URL request
|
||||
* @param int $minLength Minimum number of chars to trigger that Ajax search
|
||||
* @param int $autoselect Automatic selection if just one value
|
||||
* @return string Script
|
||||
*/
|
||||
function ajax_multiautocompleter($htmlname,$fields,$url,$option='',$minLength=2,$autoselect=0)
|
||||
function ajax_multiautocompleter($htmlname, $fields, $url, $option='', $minLength=2, $autoselect=0)
|
||||
{
|
||||
$script = '<!-- Autocomplete -->'."\n";
|
||||
$script.= '<script type="text/javascript">';
|
||||
$script.= 'jQuery(document).ready(function() {
|
||||
var fields = '.json_encode($fields).';
|
||||
var length = fields.length;
|
||||
var nboffields = fields.length;
|
||||
var autoselect = '.$autoselect.';
|
||||
//alert(fields + " " + length);
|
||||
//alert(fields + " " + nboffields);
|
||||
|
||||
jQuery("input#'.$htmlname.'").autocomplete({
|
||||
dataType: "json",
|
||||
@ -214,7 +218,7 @@ function ajax_multiautocompleter($htmlname,$fields,$url,$option='',$minLength=2,
|
||||
if (item.states) {
|
||||
jQuery("#state_id").html(item.states);
|
||||
}
|
||||
for (i=0;i<length;i++) {
|
||||
for (i=0;i<nboffields;i++) {
|
||||
if (item[fields[i]]) { // If defined
|
||||
//alert(item[fields[i]]);
|
||||
jQuery("#" + fields[i]).val(item[fields[i]]);
|
||||
@ -226,8 +230,7 @@ function ajax_multiautocompleter($htmlname,$fields,$url,$option='',$minLength=2,
|
||||
});
|
||||
},
|
||||
select: function( event, ui ) {
|
||||
|
||||
for (i=0;i<length;i++) {
|
||||
for (i=0;i<nboffields;i++) {
|
||||
//alert(fields[i] + " = " + ui.item[fields[i]]);
|
||||
if (fields[i]=="selectcountry_id")
|
||||
{
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
/**
|
||||
* \file htdocs/fichinter/fiche.php
|
||||
* \brief Fichier fiche intervention
|
||||
* \brief Page of intervention
|
||||
* \ingroup ficheinter
|
||||
*/
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user