Forums

Searching data using Chronoforms

nicholashg 15 Jun, 2011
As there is no Chronoconnectivity for CF V4, would it be easier NOT to use Chronoforms to create a search function?

I want to search for data on the basis of some fairly simple criteria but, although I've almost cracked it using non-CF pages and forms, I can't get it to work within CF partly because it's not clear what CF is doing behind the scenes in terms of database access etc.

For the sake of neatness, I'd prefer to keep everything within Chronoforms.

Is there a particular format to follow?
Any guidance would be appreciated.

Nick
GreyHead 15 Jun, 2011
Hi Nick,

I'd check out the DB Multiple Record Loader action - see the tutorial in the downloads area. I think that will do what you want in CFv4.

ChronoForms is pretty straightforward in what it does with databases - with the only exception of the few 'extra columns' that it adds.

Bob
nicholashg 16 Jun, 2011
Thanks Bob,

I'm familiar with the tutorial (I contributed a couple).

Not sure I explained correctly about this - loading fixed sets of data is no problem but what I need is to FILTER on the basis of user input, ie. a dynamic WHERE statement, what I would call a search function.

Say my table is `jos_members` with the fields `name` and `town`.
I create a form with a search field 'search_town' and a submit button. What then?
Does it actually need a DB Multi Record Loader or can I simply use JFactory::getDBO() within some kind of On Submit code?
(and other questions of this basic nature)

I know I'll eventually need checks and balances, user feedback, pagination etc. but I can hope to stitch this in later if I can just get a simple example working.

You helped me a lot with Chronoconnectivity when I was using that but I can't translate the solution to CFV4.

Nick
Max_admin 20 Jun, 2011
Hi Nick,

Yes, you need a DB Multi record loader with something like this in the WHERE box:

`name` LIKE '%<?php echo $form->data['search']; ?>%' OR `state` LIKE '%<?php echo $form->data['search']; ?>%'

-------------------------------------------------------
I have this order of actions in the on load:
show HTML
Custom server side validation -> to check "search" value in the post array
DB Multi record loader
Custom code -> to list results
-------------------------------------------------------
on Submit:
Event loop -> to reload the form

-------------------------------------------------------

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
nicholashg 20 Jun, 2011
Hi Max,

Thank you and thank you again,

This is just the guidance I was looking for.

I'll try it. Hopefully this will be an end to this topic …

Nick
Max_admin 21 Jun, 2011
No problems, let me know if you have any problems with it🙂

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.