This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use the new forum.
Home » plugins » General plug-ins » Save multiple values with autocompleter widget from sfFormExtraPlugin
Save multiple values with autocompleter widget from sfFormExtraPlugin [message #102808] Tue, 20 July 2010 16:45
NeoX  is currently offline NeoX
Messages: 58
Registered: March 2010
Location: Spain
Member

Hi all,
I've installed sfFormExtraPlugin 1.1.1 in symfony 1.4.6 and I want to use the autocompleter for save one or more values separated by commas.
This is my configuration, and actually It only saves the last value in the input text.
For example, in the attached file, it only save "rob" value.

I have not errors in Firebug but nothing appears in the form.

Function configure() in the form:

	$this->widgetSchema['etiqueta_list'] = new sfWidgetFormDoctrineJQueryAutocompleter(array(
	  'model' => 'Etiqueta',
	  'url'   => url_for('etiqueta/ajax'),
	  'config' => '{ width: 220,max: 5,highlight:false ,multiple: true,multipleSeparator: ",",scroll: true,scrollHeight: 300}'
	));


/etiquetas/actions/actions.class.php:

 function executeAjax($request)
	{
	    $this->getResponse()->setContentType('application/json');
	 
	    $etiquetas = Doctrine::getTable('Etiqueta')->retrieveForSelect(
	                $request->getParameter('q'), 
	                $request->getParameter('limit')
	    );
	 
	    return $this->renderText(json_encode($etiquetas));
	}


EtiquetaTable.class.php:
	public function retrieveForSelect($q, $limit) {
	    $q = Doctrine_Query::create()
	        ->from('Etiqueta')
	        ->andWhere('nom_etiqueta like ?', '%' . $q . '%')
	        ->addOrderBy('nom_etiqueta')
	        ->limit($limit);
	    $etiquetas = array();
	    foreach ($q->execute() as $etiqueta) {
	        $etiquetas[$etiqueta->getId()] = (string) $etiqueta;
	    }
	    return $etiquetas;
	}


Imported files in _form.php:
<?php use_javascript('jquery.js') ?>
<?php use_javascript('jquery-ui-1.8.2.custom.min.js')?>
<?php use_javascript('/sfFormExtraPlugin/js/jquery.autocompleter.js') ?>
<?php use_stylesheet('/sfFormExtraPlugin/css/jquery.autocompleter.css') ?>


Somebody could help me with this widget??
Thanks.

  • Attachment: example.jpg
    (Size: 3.02KB, Downloaded 70 time(s))

[Updated on: Tue, 20 July 2010 18:32]

Previous Topic:how do you install fpdf
Next Topic:how do I change sfWidgetFormJQueryDate culture ?
Goto Forum:
  

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software