I have made my own search - I don't want zend luciene or something
because it is very simply search - and it doesn't work :(
I think something is wrong with validation but I don't need
validation.
Search Form without validation (if I extends from sfFormDoctrine -
search also doesn't work):
class SearchForm extends sfForm
{
public function configure()
{
$this->widgetSchema['subject'] = new sfWidgetFormInput();
//I don't want validation so I disable it:
$this->validatorSchema->setOption('allow_extra_fields', true);
$this->validatorSchema->setOption('filter_extra_fields', false);
$this->widgetSchema->setNameFormat('data[%s]');
}
}
!!!$lol and $lol2 - communicates
Template:
<form action="<?php echo url_for('users/search') ?>" method="POST">
<table>
<tr>
<td><?php echo $form['subject']->render(); ?></td>
<td><input type="submit" value="Szukaj"/></td>
</tr>
</table>
</form>
<?php echo $lol; ?>
<br/>
<?php echo $lol2; ?>
!!!$lol and $lol2 - communicates
Actions:
public function executeSearch(sfWebRequest $request)
{
$this->lol = "start";
$this->lol2 = "start2";
$this->form = new SearchForm();
if ($request->isMethod('post'))
{
$this->form->bind($request->getParameter('data'));
if ($this->form->isValid())
{
$this->lol =
"ok".$this->form->getValue('subject');
$this->lol2 =
"ok2".$request->getParameter('subject');
$parameter = $this->form->getValue('subject');
$query =
Doctrine::getTable('sfGuardUserProfile')->search
($parameter);
}
else
{
$this->lol =
"error".$this->form->getValue('subject');
$this->lol2 =
"error2".$request->getParameter('subject');
}
}
}
After come in on site I see search and communicate 'start' and
'start2', after click search button I see only communicate 'error' and
'error2' (but I don't see after these communicates words which have
been written in search)- I think it means that form isn't valid but I
disable validation - what is going on ?
What is more - if I make form IN NORMAL PHP AND USE IT IN SYMFONY IT
WORKS !! Maybe in symfony I can't make forms with no validations,
maybe minimum 1 field must have a validation ????
Help ? :(
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---