Thanks troester,
But I dont' want to only display the "NO ACCOMMODATION" row in the second dbjoin list, but automatically select it, and perhaps disable the list, and enable it when another row (without "no accommodation") is selected in the first list.
Actually, the where clause of the second is "where active = true".
For example, I select in the first dbjoin element (hr5i3_fb_stay___id_french_course) the row "TEENAGERS (15/18) 10 lessons/week (No accommodation)" and I would like to automatically select "NO ACCOMMODATION" in the dbjoin element "hr5i3_fb_stay___id_accommodation".
To disable the second list, I failed with JS and didn't find how to disable, enable, hide, etc. an element with PHP or inline JS script (not a predefined action in the JavaScript tab).
I tried with a calc element to read and search for "No accommodation" in the selected row and used a JS action
Code:
on change : When this element "sel_french_course" == "No accommodation", disable element "hr5i3_fb_stay.id_accommodation"
but it doesn't work (see the attachment).
The calc element is using that PHP calculation (it observe '{hr5i3_fb_stay___id_french_course}' and works fine:
Code:
if (empty('{hr5i3_fb_stay___id_french_course}'))
{
$rest = 'MANDATORY' ;
} else {
if (str_contains('{hr5i3_fb_stay___id_french_course}','No accommodation')){
$rest = 'No Accommodation';
} else {
$rest = '{hr5i3_fb_stay___id_french_course}';
}
}
return $rest;
Is it possible in this code, when the value is "No accommodation", to define in the accommodation element either the "NO ACCOMMODATION" row or the "Veuillez choisir" row, then disable the accommodation dbjoin element, and enabled it if the value of the calculated field is not "No accommodation"?