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.
|
* 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 $selected Preselecte value
|
||||||
* @param string $htmlname HTML name of input field
|
* @param string $htmlname HTML name of input field
|
||||||
@ -34,7 +35,7 @@
|
|||||||
* @param string $urloption More parameters on URL request
|
* @param string $urloption More parameters on URL request
|
||||||
* @param int $minLength Minimum number of chars to trigger that Ajax search
|
* @param int $minLength Minimum number of chars to trigger that Ajax search
|
||||||
* @param int $autoselect Automatic selection if just one value
|
* @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
|
* @return string Script
|
||||||
*/
|
*/
|
||||||
function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLength=2, $autoselect=0, $ajaxoptions=array())
|
function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLength=2, $autoselect=0, $ajaxoptions=array())
|
||||||
@ -182,11 +183,14 @@ 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 $htmlname HTML name of input field
|
||||||
* @param string $fields other fields to autocomplete
|
* @param string $fields Other fields to autocomplete
|
||||||
* @param string $url Chemin du fichier de reponse : /chemin/fichier.php
|
* @param string $url URL for ajax request : /chemin/fichier.php
|
||||||
* @param string $option More parameters on URL request
|
* @param string $option More parameters on URL request
|
||||||
* @param int $minLength Minimum number of chars to trigger that Ajax search
|
* @param int $minLength Minimum number of chars to trigger that Ajax search
|
||||||
* @param int $autoselect Automatic selection if just one value
|
* @param int $autoselect Automatic selection if just one value
|
||||||
@ -198,9 +202,9 @@ function ajax_multiautocompleter($htmlname,$fields,$url,$option='',$minLength=2,
|
|||||||
$script.= '<script type="text/javascript">';
|
$script.= '<script type="text/javascript">';
|
||||||
$script.= 'jQuery(document).ready(function() {
|
$script.= 'jQuery(document).ready(function() {
|
||||||
var fields = '.json_encode($fields).';
|
var fields = '.json_encode($fields).';
|
||||||
var length = fields.length;
|
var nboffields = fields.length;
|
||||||
var autoselect = '.$autoselect.';
|
var autoselect = '.$autoselect.';
|
||||||
//alert(fields + " " + length);
|
//alert(fields + " " + nboffields);
|
||||||
|
|
||||||
jQuery("input#'.$htmlname.'").autocomplete({
|
jQuery("input#'.$htmlname.'").autocomplete({
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
@ -214,7 +218,7 @@ function ajax_multiautocompleter($htmlname,$fields,$url,$option='',$minLength=2,
|
|||||||
if (item.states) {
|
if (item.states) {
|
||||||
jQuery("#state_id").html(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
|
if (item[fields[i]]) { // If defined
|
||||||
//alert(item[fields[i]]);
|
//alert(item[fields[i]]);
|
||||||
jQuery("#" + fields[i]).val(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 ) {
|
select: function( event, ui ) {
|
||||||
|
for (i=0;i<nboffields;i++) {
|
||||||
for (i=0;i<length;i++) {
|
|
||||||
//alert(fields[i] + " = " + ui.item[fields[i]]);
|
//alert(fields[i] + " = " + ui.item[fields[i]]);
|
||||||
if (fields[i]=="selectcountry_id")
|
if (fields[i]=="selectcountry_id")
|
||||||
{
|
{
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/fichinter/fiche.php
|
* \file htdocs/fichinter/fiche.php
|
||||||
* \brief Fichier fiche intervention
|
* \brief Page of intervention
|
||||||
* \ingroup ficheinter
|
* \ingroup ficheinter
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user