Forums

How to retreive the textfiled value

simone.giusto.2.0815 02 Nov, 2023
Hello,

I need to filter a number of records, that I've been able to display in my page with CCv.6, by using a text field area value that the user shall fill.
I do not understand how to pass to the function that reads the DB table the value of the text field area to correctly build the relevant query.
If I put manually a value in the "Where conditions" form the query works perfectly.
However I need to populate the where condition with the text field value

Thanks!
Max_admin 03 Nov, 2023
use {data:text_field_name} to get the value of any field posted to the page
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
simone.giusto.2.0815 03 Nov, 2023
So I did, but it does not work.

Actually I've created two Functions to read the content of a Joomla DB table. The first one (read_percorsi) shows all the records, without any filter.
The second one (read_percorsi_filtro) is the same as the first one but implements a WHERE conditions: WHERE Quota max <= {data:Qta_max}

I've also created a number of views, among which two table views. One for the first function (table1) and the second one for the second function (table_filtro)

I've finally created two Events. The first displays the table1 and the field form for the filters:

{function:read_percorsi} -> to build the table
{view:filtri} -> to display the filters field area, where I've included the text field Qta_max
{view:Apply} -> to display the button triggering the filtering action
{view:table1} -> to display the table

Clicking on the button I've indicated to generate the event "filtro", which is:

{function:read_percorsi_filtro} -> I would expect that the function generates the filtered table
{view:filtri}
{view:Apply}
{view:table_filtro} -> actually displays no records. And all the records when I impose in the where conditions to Continue in case of Null value.

I assume that something in my sequence is wrong and, when I try to get the text filed value, this is already Null.
As said above, when I type in the backend an integer in the WHERE condition instead of {data:Qta_max}, the result is what I expect
simone.giusto.2.0815 06 Dec, 2023
Hallo,

any feedback?

I attach here below some snapshots of what I've done, hoping it helps someone to provide any advice.












And here below the preview I get:

The db table displayed (which is ok)


And after trying to apply a filter that should display only the records where the field Quota Max is below or equal the value I've typed in the text_field Quota massima (it was 2000)



Instead, if I type values in the Function tab:



I get in return what I need:




Thank you in advace

Simone
Max_admin 21 Jan, 2024
the field should be "inside" the form block with the listing in order for the value to be sent, can you inspect the page (right click > inspect) and check if the field is inside the form or not ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
simone.giusto.2.0815 22 Jan, 2024
Thanks Max.

I placed now the textfield in the same form as the list. The view of this form is called by the event 'index'

I want that the user, after compiling the textfield with a value, by clicking on the button gets the list filtered. What I can not understand is which event shall be triggered by clicking on the button. Shall it call the event 'index'? shall it call a different event to display the filtered list? Either ways, I do not get the result I would expect. I've again the impression that once the button calls the event the textfield value is lost.
Max_admin 25 Jan, 2024
Answer
1 Likes
you do not need to specify any events, the button should submit the parent form, that will reload the page, you may then check for the text field value in the "Read Data" conditions and add the where statement you need.
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
simone.giusto.2.0815 27 Jan, 2024
Hi Max,

Finally I made it! Many thanks.
Everything works fine.

Just a little comment: the feld 'name' appears twice in the 'General' tab of the text field, and this was a bit confusing at the beginning.

Simone
You need to login to be able to post a reply.