You can try modify the function render on
sfWidgetFormJQueryAutocompleter.class.php
I haved this problem and solve with this code.
public function render($name, $value = null, $attributes = array(),
$errors = array())
{
// put this code.
$name = $name . '[text]';
I hope it was usefull.
On Feb 16, 1:15 am, latysh KGstan altynbek1...@gmail.com wrote:
Dear folks I'm trying to solve this problem for three days no
result. Please help me in solving this problem. Thanks in advance!
I am trying to use Jquery Autocompleter for DOCTRINE...I have
installed sfFormExtraPlugin
I am using SYMFONY 1.4.8 working on Jobeet project. My goal is to
use autocompleter instead of dropdownbox for category_id in job
frontend module.
Here are the codes I'm using
CODE:
class JobeetJobForm extends BaseJobeetJobForm
{
public function configure()
{
$this-widgetSchema['category_id']-setOption('renderer_class',
'sfWidgetFormDoctrineJQueryAutocompleter');
$this-widgetSchema['category_id']-setOption('renderer_options',array('url'
= /job/ajax,'model' =
JobeetCategory));
}
}
I added following into action.class.php
CODE:
public function executeAjax($request)
{
$this-getResponse()-setContentType('application/json');
$categories = JobeetJob::retrieveForSelect($request-
getParameter('q'), $request-getParameter('limit'));
return $this-renderText(json_encode($categories));
}
And here is lib\model\JobeetJob.php file
CODE:
class JobeetJob extends BaseJobeetJob
{
static public function retrieveForSelect($q, $limit)
{
$q = Doctrine_Query::create()
-from('JobeetCategory')
-andWhere('name like ?', '%' . $q . '%');
$categories = array();
foreach ($q-execute() as $category) {
$categories[$category-getId()] = (string) $category;
}
return $categories;
}
}
I have included following js css files in layout.php file. Thay are
all working I have checked them via Mozilla html source code.
CODE:
?php use_javascript('jquery.js') ?
?php use_javascript('jquery-ui-1.8.9.custom.min.js') ?
?php use_javascript('jquery.ui.core.js') ?
?php use_javascript('jquery.ui.position.js') ?
?php use_javascript('jquery.ui.widget.js') ?
?php use_javascript('jquery.autocompleter.js') ?
?php use_stylesheet('jquery-ui-1.8.9.custom.css') ?
?php use_stylesheet('jquery.autocompleter.css') ?
When I try to access tohttp://localhost:8087/frontend_dev.php/job/ajax
if opens application/json file for download. When I open it via
notepad, i see the following
CODE: SELECT ALL
{1:Design,2:Programming,3:Manager,4:Administrator}
When I access tohttp://localhost:8087/frontend_dev.php/job/ajax?q=Manlimit=10
it gives me
CODE:
{3:Manager}
But Autocompleter is not working! What can be the reason for this.
Furebug is giving me error of
CODE:
jQuery(#autocomplete_jobeet_job_category_id).autocomplete(/job/
ajax, jQuery.extend({}, {dataType: json, parse: function (data)
{var parsed = [];for (key in data) {parsed[parsed.length] = {data:
[data[key], key], value: data[key], result: data[key]};}return
parsed;}}, {})).result is not a function
Please help me to solve this issue...
Here is what I get from Firefox html source code
CODE:
thlabel for=jobeet_job_category_idCategory/label/th
tdinput type=hidden name=jobeet_job[category_id]
id=jobeet_job_category_id /input type=text
name=autocomplete_jobeet_job[category_id] value=
id=autocomplete_jobeet_job_category_id /script type=text/
javascript
jQuery(document).ready(function() {
jQuery(#autocomplete_jobeet_job_category_id)
.autocomplete('/job/ajax', jQuery.extend({}, {
dataType: 'json',
parse: function(data) {
var parsed = [];
for (key in data) {
parsed[parsed.length] = { data: [ data[key], key ], value:
data[key], result: data[key] };
}
return parsed;
--
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 symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en