hello
i coded this line and I did not find why its not working
///create form
<?php
class ActeurSearchForm extends sfForm
{
public function configure()
{
$this->setWidgets(array
('nom' => new sfWidgetFormChoice(array
('choices' => array(),
'renderer_class'
=>'sfWidgetFormJQueryAutocompleter',
'renderer_options' => array('url' => '/Acteur/
search',),
))
));
$this->widgetSchema->setFormFormatterName('div');
}
}
////add Action
class ActeurActions extends sfActions {
public function executeIndex(sfWebRequest $request)
{
$this->form= new ActeurSearchForm();
}
}
///add action for searching
public function executeSearch(sfWebRequest $request)
{
$this->getResponse()->setContentType('application/json');
$Acteur=ActeurPeer::searchActeurAjax($request->getParameter('q'),
$request->getParameter('limit'));
return $this->renderText(json_encode($Acteur));
}
//class ActeurPeer :
public static function searchActeurAjax($q,$limit)
{
$c=new Criteria();
$c->add(self::NOM,'%'.$q.'%', Criteria::LIKE);
$c->addAscendingOrderByColumn(self::NOM);
$c->setLimit($limit);
$acteurs=array();
foreach(self::doSelect($c) as $acteur)
{
$acteurs[$acteur->getidacteur()] = $acteur->getnom();
}
return $acteurs;
}
//and finaly in template
<?php use_javascript ('/js/jquery-1.4.2.min.js'); ?>
<?php use_javascript ('/sfFormExtraPlugin/js/
jquery.autocompleter.js') ;?>
<?php use_stylesheet ('/sfFormExtraPlugin/css/
jquery.autocompleter.css'); ?>
<form action="<?php echo url_for('Acteur/Detail') ?>" method="POST">
<?php echo $form['nom']; ?>
<input type="submit" value="Rechercher" />
</form>
--
If you want to report a vulnerability issue on symfony, please send it to
security at symfony-project.com
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