How to use library and data binding

Hi, I’ve done a test because I want to understand how to use library (include and exec).
So, on this page
https://www.campaniaturismo.org/admin/admin-vicinanze-comuni-add-new.php?id=8
I want to show the name of a city filtered by a query string.
On this page you can see:
Aggiungi località nelle vicinanze di Avellino
Avellino is taken from a database filtered by the query string id=8
I’ve done it in the classical way, an action file with $_GET variable in the input section of the action file.
I try the same thing using library and an exec API.
Unfortunately it doesn’t run.
You should see “Avellino” under the previous row but you don’t.
Does anyone know what’s wrong?
Thank you

PS. per gli utenti italiani c’è un server discord dedicato che tutti possono utilizzare per postare le proprie domande e ricevere aiuto dalla comunità degli utenti.

Hi Teodor as nobody answers can you help me?

Which version of wappler and server language are you using ?
I couldn’t get include to work yetand opened a bug report Server Include values not being passed

but exec is working just fine on my end.

Hi Andrea,
Have you added the filter variable to the App Query params?

EDIT: Sorry, looks like you did add the variable so please dismiss this post…

hi, wappler version is 3.6.1. I don’t know server language. Maybe english

Hi guys, no more help?

Maybe I’m wrong when I insert an API action on the page. I insert it in a server connect. Is it right? Please Teodor answer me

that’s what I mean

Hi,
You need to pass query params that gets the id from the browser. Then you need to pass the query param to the server action.



Thank you but already done. There’s something else wrong

I did see it just after I posted. I did a test and it seems like the library actions do not work when inside subfolder. Try not using subfolder, then its working for me.

Thank you.
I’ve tried but nothing.
Have you used library for your purposes till now?
If yes, have you had the same problem?

I have not used it in a real project, but tried when I did see your problem.

:+1:

Using library item is like calling a function, you have to give it its input variables.

So you need to define our $_GET in your main action and also in your library action.

Then when you exec the library action, give as its input the $_GET input from the main action. So they value is passed.

Other way is just to include the library action then you don’t need to bind any parameters as it is just inline included. You still have to define the same $_GET parameter in both before usage.

so I’ve to define $_GET variable in both library and exec?
I ask you because I’ve defined $_PARAM in library

this is the test page:
https://www.campaniaturismo.org/test_room/test_api_action.php?id=8
it doesn’t run

more details about library api action


look at he $_GET variable