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 » Javascript plugins » autocomplete doesn't work
autocomplete doesn't work [message #97570] Mon, 19 April 2010 02:55 Go to next message
aszrool  is currently offline aszrool
Messages: 8
Registered: March 2010
Junior Member
I am using sfFormExtraPlugin which is using sfWidgetFormJQueryAutocompleter and used the tips on http://symfonyguide.wordpress.com/2009/08/05/lautocompletion -sur-un-input-text-du-backend/ ... I am also had tried another way in other sources.

Unfortunately, when I tried to input whatever words, the input text field shows the loading animation without any words suggestion appear. Is there any solution I can get? Or can tell me what am I mistakes?

[Updated on: Mon, 19 April 2010 02:56]

Re: autocomplete doesn't work [message #97994 is a reply to message #97570 ] Sat, 24 April 2010 16:17 Go to previous messageGo to next message
peerffm  is currently offline peerffm
Messages: 18
Registered: February 2010
Location: China
Junior Member
it should work.


Form
class AutoCompleteForm extends sfForm

{
  public function configure()
  {
  
    $this->setWidgets(array(
      ''   => new sfWidgetFormJQueryAutocompleter(array('url' => 'controller/action'))
    ));
   
  }
 
}


controller
 $this->getResponse()->setContentType('application/json');

  
     $criteria = new Criteria();
     $criteria->add(youModel::NAME, "%".$request->getParameter('q')."%" , Criteria::LIKE);

 foreach (youModel::doSelect($criteria) as $ret)
    {
      $result [$ret->getID()] = (string) $ret;
    }
    
    $this->renderText(json_encode($result));
    return sfView::NONE;


controller action index
$this->Autocomplete=new AutocompletetForm();


View

<?php echo $Autocomplete; ?>






Re: autocomplete doesn't work [message #97996 is a reply to message #97570 ] Sat, 24 April 2010 16:23 Go to previous messageGo to next message
peerffm  is currently offline peerffm
Messages: 18
Registered: February 2010
Location: China
Junior Member

try this and look what firebug say.
Re: autocomplete doesn't work [message #100961 is a reply to message #97996 ] Tue, 15 June 2010 11:55 Go to previous message
allel  is currently offline allel
Messages: 7
Registered: June 2010
Location: paris
Junior Member

Hello
i had the same problem but i have resolved after reading your code THANKS, but now i have another problem, i would insert three sfWidgetFormJQueryAutocompleter
only one works

first form
<?php
class SymptomeSearchForm extends sfForm
{
	public function configure()
	{			
		$this->setWidgets(array(
      ''   => new sfWidgetFormJQueryAutocompleter(array('url' => 'BaseDeConnaissance/symptome'))  ));
	}	
}


second form
<?php
class SsaSearchForm extends sfForm
{
	public function configure()
	{			
		$this->setWidgets(array(
      ''   => new sfWidgetFormJQueryAutocompleter(array('url' => 'Ssa/search'))  ));
	}	
}


third form
<?php
class RootCauseSearchForm extends sfForm
{
	public function configure()
	{
		$this->setWidgets(array(
      ''   => new sfWidgetFormJQueryAutocompleter(array('url' => 'BaseDeConnaissance/root'))  ));
		
	}	
}


controller
public function executeSymptome(sfWebRequest $request)
  {
  	$this->getResponse()->setContentType('application/json');
  	$symptome=SymptomePeer::searchSymptomeAjax($request->getParameter('q'),$request->getParameter('limit'));
  	 $this->renderText(json_encode($symptome));
  	
  	 return sfView::NONE;
  	 
  }
  
  public function executeRoot(sfWebRequest $request)
  {
  	$this->getResponse()->setContentType('application/json');
  	$rootcause=RootcausePeer::searchRootcauseAjax($request->getParameter('q'),$request->getParameter('limit'));
  	$this->renderText(json_encode($rootcause));
  	
  	return sfView::NONE;
  }
  
  public function executeImpact(sfWebRequest $request)
  {
  	$this->getResponse()->setContentType('application/json');
  	$impact=ImpactPeer::searchImpactAjax($request->getParameter('q'),$request->getParameter('limit'));
  	$this->renderText(json_encode($impact));
  	
  	return sfView::NONE;
  }
  


index controller
public function executeIndex(sfWebRequest $request)
  	{
  		$this->formRootCause= new RootCauseSearchForm();
  		$this->RootCauseArray=RootcausePeer::getAllRootCause(
  		$request->getParameter('pageRootCause'),
  		sfConfig::get('app_total_items_rootcause')); 
	  	
	  	$this->formSymptome= new SymptomeSearchForm();
	  	$this->symptomeArray=SymptomePeer::getAllSymptome(
	  	$request->getParameter('page'),
	  	sfConfig::get('app_total_items_symptome'));
		
	  	$this->formImpact= new ImpactSearchForm();
	  	$this->ImpactArray= ImpactPeer::getAllImpact(
	  	$request->getParameter('pageImpact'),
	  	sfConfig::get('app_total_items_impact'));
	  	
  	return sfView::SUCCESS;
  }


just the first works



Previous Topic:Dialog Box for Symfony 1.4
Next Topic: integrating galleria into symfony 1.4
Goto Forum:
  

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