Hi Bob/All. In v3, we are using the Chronocontact to search data and show the data from our database into the form. However, we upgrade our version to v4 and since Chronocontact is not available in v4, I need to create a search button and show data from DB using the v4. In my db table, I only have two fields:numbercode (primarykey) and codename(varchar). In my form, I have the textbox to type any words like "hello" and a search button to search and show all the numbercode and codename that has a "hello" word in the database.I tried the tutorial "list table in multiple rows and edit data" but somehow, it shows no data at all. I am confused about the Model ID. What is the Model ID about and what will I need to include it there? Also, in the tutorial "list table in multiple rows..." would it be possible to know what are the DB fields you used? I guess that will help a lot to follow the instruction. Thanks!
Forums
Search data from DB and show in form problem
Hi jmarian1,
I assume that by ChronoContact here you mean ChronoConnectivity - the sister application to ChronoForms?
I think that the Model ID is used to identify a sub-set of the form data so you have $form->data as an arry with all of the data and $form->data['some_id'] is a sub-array that you can use. I guess this helps when you want to save different parts of the data to different database tables. I haven't yet needed to use this feature.
I didn't write the tutorial and don't know what the DB columns are I can see 'cf_uid' and 'profession' used though.
Bob
I assume that by ChronoContact here you mean ChronoConnectivity - the sister application to ChronoForms?
I think that the Model ID is used to identify a sub-set of the form data so you have $form->data as an arry with all of the data and $form->data['some_id'] is a sub-array that you can use. I guess this helps when you want to save different parts of the data to different database tables. I haven't yet needed to use this feature.
I didn't write the tutorial and don't know what the DB columns are I can see 'cf_uid' and 'profession' used though.
Bob
Hi,
I would do it like this in V4:
1- Change my form method to "get" instead of "post"
2- change the submit url to the same as the load url OR change the "submit action" setting to "self"
(1,2 are under the "Edit" page)
3- Add the show HTML to the on load along with a "db multi record loader"
4- the db multi record loader should have a good WHERE command to do the search, assuming your search field is named "search":
That should load the results, you may add a "debugger" action after the "multi record loader" to show you the results returned before you use a "custom code" to render them.
Regards,
Max
I would do it like this in V4:
1- Change my form method to "get" instead of "post"
2- change the submit url to the same as the load url OR change the "submit action" setting to "self"
(1,2 are under the "Edit" page)
3- Add the show HTML to the on load along with a "db multi record loader"
4- the db multi record loader should have a good WHERE command to do the search, assuming your search field is named "search":
`codename` LIKE '%<?php echo $form->data['search']; ?>%' OR `numbercode` LIKE '%<?php echo $form->data['search']; ?>%'
That should load the results, you may add a "debugger" action after the "multi record loader" to show you the results returned before you use a "custom code" to render them.
Regards,
Max
This topic is locked and no more replies can be posted.