How to pass the autocomplete value if it is not one of the suggested results
I have managed to build a working autocomplete in symfony wit开发者_开发技巧h the sfWidgetFormJQueryAutocompleter like this :
$this->widgetSchema['expediteur'] = new sfWidgetFormJQueryAutocompleter(array('url' => 'autocompleteExpediteur',
'config' => '{
scrollHeight: 300,
autoFill: false}'));
$this->validatorSchema['expediteur'] = new sfValidatorPass();
It works fine if I choose one of the suggested results but if I try to enter a new value nothing gets passed to my action (simplified) :
protected function processForm(sfWebRequest $request, sfForm $form)
{
$form->bind($request->getParameter($form->getName()));
echo($form->getValue('expediteur')):
}
I have looked through all the demos on : http://view.jquery.com/trunk/plugins/autocomplete/demo/ but have not found how to pass the value if it is not one of the suggested results. I dont know if it is a jQuery / autocomplete or Symfony problem but any help would be mutch appreciated.
Is your AJAX Script called correctly, your can see it with the Firefox plugin firebug. It seems you all the wrong URL ("autocompleteExpediteur"). Your URL-Parameter should be someting like "url_for('module/action')".
精彩评论