Forums

Advanced Search Form

federico85 28 Mar, 2012
Hi folks!
When I tried to set up an Advanced Search Form using chronoconnectivity (joomla 1.5) there was an amazing tutorial on this site and i got it working. Now i'd like this to be "translated" for chronoforms v4 and joomla 1.7.
I searched a lot on this forum but it seems to me there is no answers or explanations regarding this argument.
Following the guidelines of this post http://www.chronoengine.com/forums.html?cont=posts&f=26&t=43294 and your tutorial regarding Multi Record Loader I was able to implement a working simple search form.
Now i would like to change it and use drop down and checkboxes instead of simple text boxes. I tried simply replacing (in HTML) text boxes with select boxes but it doesn't work.
Could somebody help me understanding how the code in where box container must be modified to be used with select boxes and checkboxes showing me an example?

Thanks in advance for your help!
GreyHead 29 Mar, 2012
Hi federico85,

First Max has now released ChronoConnectivity v4 - though at present not everything seems to be working smoothly.

That's a long thread you linked to - what code are you using and which bits don't work? Standard drop-downs and radio boxes should work in pretty much the same way as text input; multi-select drop-downs and checkbox groups will return multiple results in an array that may need to be handled differently.

Bob
federico85 29 Mar, 2012
Hi Bob,
first of all thanks for your reply! Yur advice are always useful!

I'm happy to hear news about ChronoConnectivity v4.

I tried to prepare a basic form using 2 text boxes and a submit button and using this code
`name` LIKE '%<?php echo $form->data['name']; ?>%' OR `surname` LIKE '%<?php echo $form->data['surname']; ?>%'
in WHERE box and it worked.

If I try to replace those fields with drop-downs it does not work and as you said, it's because I'm using multi-select drop-downs.

How do I have to manage WHERE box for handling multi-select drop-downs and checkboxes?

Thanks again!
GreyHead 06 Apr, 2012
Hi federico85,

If you have an array result you have to turn it into a comma separated and quoted list to use in the MySQL query:
<?php
$names = array();
$db =& JFactory::getDBO();
foreach ( $form->data['name'] as $v ) {
  $names[] = $db->quote('%'.$v.'%');
}
$names = implode(', ', $names);
?>
`name` LIKE (<?php echo $names; ?>) 
and the same for the surnames.

Bob
federico85 07 Apr, 2012
Thanks Bob!
I got it working!
This topic is locked and no more replies can be posted.