Make code more jquery compliant
This commit is contained in:
parent
4ada220083
commit
34c7295cbc
@ -697,7 +697,8 @@ class FormTicket
|
|||||||
if ($num_rows == 1) {
|
if ($num_rows == 1) {
|
||||||
return '<input type="hidden" name="'.$htmlname.'" id="'.$htmlname.'" value="'.dol_escape_htmltag($groupvalue).'">';
|
return '<input type="hidden" name="'.$htmlname.'" id="'.$htmlname.'" value="'.dol_escape_htmltag($groupvalue).'">';
|
||||||
}
|
}
|
||||||
$stringtoprint .= '</select> ';
|
$stringtoprint .= '</select> ';
|
||||||
|
|
||||||
$levelid = 1;
|
$levelid = 1;
|
||||||
while ($levelid <= $use_multilevel) {
|
while ($levelid <= $use_multilevel) {
|
||||||
$tabscript = array();
|
$tabscript = array();
|
||||||
@ -756,19 +757,27 @@ class FormTicket
|
|||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
}
|
}
|
||||||
$stringtoprint .='</select>';
|
$stringtoprint .='</select>';
|
||||||
|
//$stringtoprint .= ajax_combobox($htmlname.'_child_'.$levelid);
|
||||||
|
|
||||||
$stringtoprint .='<script>';
|
$stringtoprint .='<script>';
|
||||||
$stringtoprint .='arraynotparents = '.json_encode($arraycodenotparent).';';
|
$stringtoprint .='arraynotparents = '.json_encode($arraycodenotparent).';';
|
||||||
$stringtoprint .='if (arraynotparents.includes($("#'.$htmlname.($levelid > 1 ?'_child_'.$levelid-1:'').'")[0].value)){$("#'.$htmlname.'_child_'.$levelid.'").hide()}
|
$stringtoprint .='if (arraynotparents.includes($("#'.$htmlname.($levelid > 1 ?'_child_'.$levelid-1:'').'")[0].value)){$("#'.$htmlname.'_child_'.$levelid.'").hide()}
|
||||||
|
|
||||||
$("#'.$htmlname.($levelid > 1 ?'_child_'.$levelid-1:'').'").change(function() {
|
$("#'.$htmlname.($levelid > 1 ?'_child_'.$levelid-1:'').'").change(function() {
|
||||||
child_id = this.attributes.child_id.value;
|
child_id = $("#'.$htmlname.($levelid > 1 ?'_child_'.$levelid-1:'').'").attr("child_id");
|
||||||
|
console.log("We select a new value into combo child_id="+child_id);
|
||||||
|
|
||||||
|
/* Hide all selected box that are child of the one modified */
|
||||||
$(".groupticketchild").each(function(){
|
$(".groupticketchild").each(function(){
|
||||||
if(this.attributes.child_id.value > child_id){
|
if ($(this).attr("child_id") > child_id) {
|
||||||
this.value = ""
|
console.log("hide child_id="+$(this).attr("child_id"));
|
||||||
$(this).attr("style", "display : none;")
|
$(this).val("");
|
||||||
|
$(this).hide();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
$("#'.$htmlname.'_child_'.$levelid.'")[0].value = ""
|
|
||||||
|
/* Now we enable the next combo */
|
||||||
|
$("#'.$htmlname.'_child_'.$levelid.'").val("");
|
||||||
if (!arraynotparents.includes(this.value)) {
|
if (!arraynotparents.includes(this.value)) {
|
||||||
$("#'.$htmlname.'_child_'.$levelid.'").show()
|
$("#'.$htmlname.'_child_'.$levelid.'").show()
|
||||||
} else {
|
} else {
|
||||||
@ -782,6 +791,8 @@ class FormTicket
|
|||||||
$stringtoprint .='})';
|
$stringtoprint .='})';
|
||||||
$stringtoprint .='</script>';
|
$stringtoprint .='</script>';
|
||||||
}
|
}
|
||||||
|
$stringtoprint .= ajax_combobox($htmlname);
|
||||||
|
|
||||||
return $stringtoprint;
|
return $stringtoprint;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user