My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php

/*
* This file is part of the symfony package.
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

/**
* sfWidgetFormDoctrineJQueryQuickSearchAutocompleter represents an autocompleter input widget rendered by JQuery
* optimized for foreign key lookup, that will load a new page with the selected item
*
* This implementation is based on sfWidgetFormPropelJQueryAutocompleter/sfWidgetFormDoctrineJQueryQuickSearchAutocompleter.
*
* @package symfony
* @subpackage widget
* @author Lukas Smith <smith@pooteeweet.org>
*/
class sfWidgetFormDoctrineJQueryQuickSearchAutocompleter extends sfWidgetFormDoctrineJQueryAutocompleter
{
public function render($name, $value = null, $attributes = array(), $errors = array())
{
$url = url_for('@default_edit?module='.strtolower($this->getOption('model')).'&action=edit&id=XXX');
$widget = parent::render($name, '', $attributes, $errors);
$widget = str_replace('.val(data[1]);', ".val(data[1]); if (data[1].replace(/ /, '') !== '') { url = '$url'; location.href = url.replace(/XXX/, data[1]); }", $widget);
return $widget;
}
}

Change log

r226 by lukas.smith on Apr 21, 2010   Diff
minor tweak for two step autocompletion
Go to: 
Project members, sign in to write a code review

Older revisions

r223 by lukas.smith on Apr 21, 2010   Diff
never set a value for the quick search
r222 by lukas.smith on Apr 21, 2010   Diff
implemented quick edit search
All revisions of this file

File info

Size: 1267 bytes, 30 lines
Powered by Google Project Hosting