I wish to replace an integer id field with a lookup string value from another table in the Modules->Clients->show.php file.
I have created a function with an SQL query to get the related value, but I cannot call the function in the show.php file.
I keep getting a "function is undefined" error while trying to call the function.
Any pointers will be appreciated, Thanks.
Trongate is Awesome!
custom queries for show view
4 years ago
4 years ago
#1
4 years ago
#2
Hello KeepCalm,
Posting your function and you call to the function will help.
Use
code and /code tags with your code inbetween and [ ] around the word code and /code
Look at this from the docs:
https://trongate.io/docs_m/information/calling-another-module-from-a-view
Dan
Posting your function and you call to the function will help.
Use
code and /code tags with your code inbetween and [ ] around the word code and /code
Look at this from the docs:
https://trongate.io/docs_m/information/calling-another-module-from-a-view
Dan
4 years ago
#3
Thanks djnordeen, here is the function
I tried to call the function in the show.php file :
Ok This issue has been solved. I deleted the function and added the SQL directly to the show() function.
I tried to call the function in the show.php file :
Ok This issue has been solved. I deleted the function and added the SQL directly to the show() function.
4 years ago
#4
Hi KeepCalm,
Yes, Trongate is Awesome!
Just following up on your previous post. It's good that you have moved the SQL to the controller, but you didn't have to delete the method getlocation(), you could have just added an underscore to make it inaccessible from the URL, like _getlocation() and more importantly you should be more careful with the query() method when passing from the URL, as it's a real threat of SQL injection.
A more safe method would be to use query_bind().
Let me know if you need help with that?
Yes, Trongate is Awesome!
Just following up on your previous post. It's good that you have moved the SQL to the controller, but you didn't have to delete the method getlocation(), you could have just added an underscore to make it inaccessible from the URL, like _getlocation() and more importantly you should be more careful with the query() method when passing from the URL, as it's a real threat of SQL injection.
A more safe method would be to use query_bind().
Let me know if you need help with that?
4 years ago
#5
Thank you Dafa for following up.
After reading the documentation, I decided to use Trongate's database methods like get() and get_where()
where suitable, instead of my previous direct sql calls to the database.
Where I am struggling however, is in getting dependent dropdowns to work.
I suspect that I may have to use javascript to listen for a change event from the first dropdown and then call a function to
populate the second dropdown, but javascript and php are new to me (I am a former VBA developer).
My project heavily relies on dependent dropdowns (building a Task logging, assignment and reporting app for a company intranet), so any tips would be welcome.
Cheers!
After reading the documentation, I decided to use Trongate's database methods like get() and get_where()
where suitable, instead of my previous direct sql calls to the database.
Where I am struggling however, is in getting dependent dropdowns to work.
I suspect that I may have to use javascript to listen for a change event from the first dropdown and then call a function to
populate the second dropdown, but javascript and php are new to me (I am a former VBA developer).
My project heavily relies on dependent dropdowns (building a Task logging, assignment and reporting app for a company intranet), so any tips would be welcome.
Cheers!
4 years ago
#6
Hi KeepCalm,
I'm a fellow VBA coder and have created some pretty heavy apps in MS Access for local government and other clients. I don't do much of that now, as my focus has shifted solely to web apps. However, I still have some clients that use my projects with a MS Access front end for desktop and a web app for mobile that connects to the same db via an ODBC connection.
As for your linked dropdowns, yes JavaScript is the solution. There are many tutorials on YT and the net that solve this for you.
Here is an example on W3S > https://www.w3schools.com/howto/howto_js_cascading_dropdown.asp
If you need help, let me know :)
I'm a fellow VBA coder and have created some pretty heavy apps in MS Access for local government and other clients. I don't do much of that now, as my focus has shifted solely to web apps. However, I still have some clients that use my projects with a MS Access front end for desktop and a web app for mobile that connects to the same db via an ODBC connection.
As for your linked dropdowns, yes JavaScript is the solution. There are many tutorials on YT and the net that solve this for you.
Here is an example on W3S > https://www.w3schools.com/howto/howto_js_cascading_dropdown.asp
If you need help, let me know :)
4 years ago
#7
Hi Simon, I eventually got my dynamic dropdowns to work quite well using ajax/jquery,
The performance is good but I am wondering if the same could be done using plain javascript instead without the overhead of jquery.
Otherwise, I must say that Trongate almost makes my project easy, as a total web/php noob, I have made more progress in less than two weeks of using Trongate than I did trying to get the same project done in WPF over two months.
The only thing that I am completely stumped on is how to handle multiple instances of sub forms, but i think that is more so due to my lack of html experience rather than Trongate's limits.
I really love this framework and I wished I had discovered it sooner!
Cheers!
The performance is good but I am wondering if the same could be done using plain javascript instead without the overhead of jquery.
Otherwise, I must say that Trongate almost makes my project easy, as a total web/php noob, I have made more progress in less than two weeks of using Trongate than I did trying to get the same project done in WPF over two months.
The only thing that I am completely stumped on is how to handle multiple instances of sub forms, but i think that is more so due to my lack of html experience rather than Trongate's limits.
I really love this framework and I wished I had discovered it sooner!
Cheers!