[symfony-users] Re: sfWidgetFormDoctrineJQueryAutocompleter problem

2011-03-11 Thread emanu.ti
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


[symfony-users] sfWidgetFormChoice

2010-12-29 Thread emanu.ti
Hi, I want to use sfWidgetFormChoice with multiple = true
parameter. Here is my code:

'leavewhenempty'  = new sfWidgetFormChoice(
 array('multiple' = true, 'expanded' = true,
'choices' = Doctrine_Core::getTable('FilaDeAtendimento')-
getOptionsLeaveWhenEmpty())
  ),

'leavewhenempty'  = new sfValidatorChoice(
 array('multiple' = true, 'choices' = array_keys(
 
Doctrine_Core::getTable('FilaDeAtendimento')-
getOptionsLeaveWhenEmpty()
 ),
'required' = false)
   ),

but, when I save this form,on my database, is saved the string
Array. I need save the values of checkbox checked, and, when I want
edit this register, the checkbox comes checked with the values stored
on my database. How solve this?

thank's all.

-- 
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


[symfony-users] sfWidgetFormSelectDoubleList

2010-11-27 Thread emanu.ti
Hi all,
I use Symfony 1.4

I want to configure a select double list using
sfWidgetFormSelectDoubleList.
My question:
  - How can a configure the ASSOCIATED items?
To the widget's constructor I give the possible options via
'choices' option, ok. But what about the selected defaults?
I figured out that the FormField's '$value' property holds
the array of associated items, but where can I set this?
I really don't wan't to make field's $value public and set
this in my input template... ;-)
Can anyone help me out? Thanks!

this is my code:
'codecs_list' = $this-widgetSchema['codecs_list']
-setOption('renderer_class',
'sfWidgetFormSelectDoubleList')
-setOption('order_by',
array('id', 'asc'))
-
setOption('renderer_options' , array('label_unassociated' =
'Desativados',
 
'label_associated' = 'Ativados',
 
'associated_first' = false))

On this context, where i can include default values to associated
select??

-- 
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