Forums

where conditions for a dropdown autocomplete inside a repeater area

Gangrel 19 Mar, 2019
good morning
I have an autocomplete dropdown inserted into a repeater area.
the data is provided by an event called "auto_codice_materiale" which contains a read data that retrieves data from my DB.

the repeater area is called area_repeater6
and the dataprovider is: {data:Model}

the dropdown name is Model[{var:area_repeater6.key}][descrizione_materiale]
his id is descrizione_materiale{var:area_repeater6.key}

the read data model name is: materiale

my problem is that I am unable to compile "where conditions" of my read data.

I tried inserting in the where conditions: materiale.descrizione_materiale/LIKE:%{data:Model[{var:area_repeater6.key}][descrizione_materiale]}%

where "materiale" is the model name
"descrizione_materiale" is the field name
but doesn't work.

data:Model[{var:area_repeater6.key}][descrizione_materiale] is correct?
thank you very much
Max_admin 19 Mar, 2019
Answer
Hi Gangrel,

No, you need to get the field name differently, you need a PHP block before the "read data" to get the value from the data array:
return array_values($this->data("Model.[n]"))[0]["descrizione_materiale"];
Name your php action "avalue", then use this call in the conditions:
materiale.descrizione_materiale/LIKE:%{var:avalue}%

Best regards
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Gangrel 19 Mar, 2019
ok, now it works!!
thank you so much🙂
This topic is locked and no more replies can be posted.