1778 Posts in 581 Topics by 555 members
| Go to End | ||
| Author | Topic: | 2154 Views |
-
Re: Problem with search and scaffolded searchform

27 April 2010 at 11:09pm Last edited: 27 April 2010 11:09pm
This became more complicated than i thought.
Filtering while searching is of course much better. Should have thought about that. Thank you guys.
But i cannot push a new Hiddenfield into the searchform since that value doesn't exist in the searchContext. Even if I do that the search ignores that field.I guess it would be possible to push something similar into $context but that is to complex of a variable for me to understand when i print_r it.
Adding a new value to searchable_fields on the dataobject (so that it will be included in defaultSearchContext) works. I can then remove the field from the form and then add the key-value pair again right before doing the search:
$context = singleton('Apartment')->getDefaultSearchContext();
//Add fields so that only published are shown and only related.
$data['ApartmentStatus'] = "Publicerad";
$data['ApartmentListID'] = $this->ID;
$results = $context->getResults($data);Thanks again!
Javelin
| 2154 Views | ||
| Go to Top |

