[symfony-users] Re: autocomplete in symfony and doctrine

2009-09-23 Thread Abraham Montilla
wow, thanks very much! i'll check it asap.

2009/9/23 Romain de Wolff 

>
> Hello,
>
> About the auto complete in the backend, I got it working.
>
> There is a french article that explain it, maybe you can translate it
> with google :
>
>
> http://symfonyguide.wordpress.com/2009/08/05/lautocompletion-sur-un-input-text-du-backend/
>
> In a few words, you need :
>
> - check that the javascript and css of the auto complete are in the
> form template (or global, which is not adviced, as the css/js will be
> loaded on all page, even when not needed)
>
> - in the form (ModuleNameForm.class.php) : add the required
> widgetShema like this, where field_name is the field you want to
> enable auto complete :
>
> $this->widgetSchema['field_name'] = new sfWidgetFormJQueryAutocompleter
> (array('url' => "../clients/ajax"));
>
> PS: I noticed that you _have to_ use "new sfWidget..." for this to
> work.
>
> - define the action in the proper module (here, in /apps/backend/
> modules/clients/actions/actions.class.php), and watch out for the
> proper getResponse()->setContentType('application/json'). use
> Doctrine, and keep it MVC (put the query in the model). Check that you
> return using renderText and json_encode.
>
> And that's it!
>
> I'd be glad to help, don't hesitate if you want more details.
>
> Good luck,
>
> Romain
>
> On 23 sep, 05:43, Abraham Montilla  wrote:
> > i still have the same problem Romain, i desisted.
> >
> > 2009/9/22 Romain de Wolff 
> >
> >
> >
> >
> >
> >
> >
> > > Hello,
> >
> > > I'm currently facing the same problem.
> >
> > > Does anyone have a solution, an idea or even better, a solution to
> > > propose?
> >
> > > Thanks,
> >
> > > Romain
> >
> > > On 11 sep, 00:38, Abraham  wrote:
> > > > Hello folks, i'm trying to add an autocomplete field in a form, to do
> > > > that i've followed the Make your choice! tutorial:
> >
> > > >
> http://www.symfony-project.org/blog/2008/10/14/new-in-symfony-1-2-mak...
> >
> > > > and used the Doctrine autocompleter yet-to-be-released-class:
> >
> > > >http://trac.symfony-project.org/attachment/ticket/6012/sfWid
> > > > getFormDoctrineJQueryAutocompleter.class.php
> >
> > > > to substitute the Propel class used in the tutorial, but when i type
> > > > something in the widget no autocompletion box appears... I even tried
> > > > using just the sfWidgetFormJQueryAutocompleter (wich is supposed to
> > > > just get the IDs from the foreign table instead of any attribute you
> > > > want) but nothing.
> >
> > > > i'm trying to adapt the autocompletion in an admin module, i can see
> > > > the javascript embedded in the source code of the generated page but
> > > > no box shows up... also i wrote directly in the address bar
> "localhost/
> > > > myApp_dev.php/myModule/autocomplete" (having the executeAutocomplete
> > > > action y actions.class.php), and a file 'autocomplete' can be
> > > > downloaded, the content of the file is the array that
> > > > executeAutocomplete returns, in my case:
> >
> > > > {"V-01":"Jack Mort", "V-02":"Roland Deschain", "H-01":"Susannah
> > > > Holmes"}
> >
> > > > so i think i'm pretty near but not enough, can you help me?
> >
> > --
> > Have a nice day.
> > Abraham Montilla.
> >
>


-- 
Have a nice day.
Abraham Montilla.

--~--~-~--~~~---~--~~
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] Re: autocomplete in symfony and doctrine

2009-09-23 Thread Romain de Wolff

Hello,

About the auto complete in the backend, I got it working.

There is a french article that explain it, maybe you can translate it
with google :

http://symfonyguide.wordpress.com/2009/08/05/lautocompletion-sur-un-input-text-du-backend/

In a few words, you need :

- check that the javascript and css of the auto complete are in the
form template (or global, which is not adviced, as the css/js will be
loaded on all page, even when not needed)

- in the form (ModuleNameForm.class.php) : add the required
widgetShema like this, where field_name is the field you want to
enable auto complete :

$this->widgetSchema['field_name'] = new sfWidgetFormJQueryAutocompleter
(array('url' => "../clients/ajax"));

PS: I noticed that you _have to_ use "new sfWidget..." for this to
work.

- define the action in the proper module (here, in /apps/backend/
modules/clients/actions/actions.class.php), and watch out for the
proper getResponse()->setContentType('application/json'). use
Doctrine, and keep it MVC (put the query in the model). Check that you
return using renderText and json_encode.

And that's it!

I'd be glad to help, don't hesitate if you want more details.

Good luck,

Romain

On 23 sep, 05:43, Abraham Montilla  wrote:
> i still have the same problem Romain, i desisted.
>
> 2009/9/22 Romain de Wolff 
>
>
>
>
>
>
>
> > Hello,
>
> > I'm currently facing the same problem.
>
> > Does anyone have a solution, an idea or even better, a solution to
> > propose?
>
> > Thanks,
>
> > Romain
>
> > On 11 sep, 00:38, Abraham  wrote:
> > > Hello folks, i'm trying to add an autocomplete field in a form, to do
> > > that i've followed the Make your choice! tutorial:
>
> > >http://www.symfony-project.org/blog/2008/10/14/new-in-symfony-1-2-mak...
>
> > > and used the Doctrine autocompleter yet-to-be-released-class:
>
> > >http://trac.symfony-project.org/attachment/ticket/6012/sfWid
> > > getFormDoctrineJQueryAutocompleter.class.php
>
> > > to substitute the Propel class used in the tutorial, but when i type
> > > something in the widget no autocompletion box appears... I even tried
> > > using just the sfWidgetFormJQueryAutocompleter (wich is supposed to
> > > just get the IDs from the foreign table instead of any attribute you
> > > want) but nothing.
>
> > > i'm trying to adapt the autocompletion in an admin module, i can see
> > > the javascript embedded in the source code of the generated page but
> > > no box shows up... also i wrote directly in the address bar "localhost/
> > > myApp_dev.php/myModule/autocomplete" (having the executeAutocomplete
> > > action y actions.class.php), and a file 'autocomplete' can be
> > > downloaded, the content of the file is the array that
> > > executeAutocomplete returns, in my case:
>
> > > {"V-01":"Jack Mort", "V-02":"Roland Deschain", "H-01":"Susannah
> > > Holmes"}
>
> > > so i think i'm pretty near but not enough, can you help me?
>
> --
> Have a nice day.
> Abraham Montilla.
--~--~-~--~~~---~--~~
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] Re: autocomplete in symfony and doctrine

2009-09-22 Thread Abraham Montilla
i still have the same problem Romain, i desisted.

2009/9/22 Romain de Wolff 

>
> Hello,
>
> I'm currently facing the same problem.
>
> Does anyone have a solution, an idea or even better, a solution to
> propose?
>
> Thanks,
>
> Romain
>
> On 11 sep, 00:38, Abraham  wrote:
> > Hello folks, i'm trying to add an autocomplete field in a form, to do
> > that i've followed the Make your choice! tutorial:
> >
> > http://www.symfony-project.org/blog/2008/10/14/new-in-symfony-1-2-mak...
> >
> > and used the Doctrine autocompleter yet-to-be-released-class:
> >
> > http://trac.symfony-project.org/attachment/ticket/6012/sfWid
> > getFormDoctrineJQueryAutocompleter.class.php
> >
> > to substitute the Propel class used in the tutorial, but when i type
> > something in the widget no autocompletion box appears... I even tried
> > using just the sfWidgetFormJQueryAutocompleter (wich is supposed to
> > just get the IDs from the foreign table instead of any attribute you
> > want) but nothing.
> >
> > i'm trying to adapt the autocompletion in an admin module, i can see
> > the javascript embedded in the source code of the generated page but
> > no box shows up... also i wrote directly in the address bar "localhost/
> > myApp_dev.php/myModule/autocomplete" (having the executeAutocomplete
> > action y actions.class.php), and a file 'autocomplete' can be
> > downloaded, the content of the file is the array that
> > executeAutocomplete returns, in my case:
> >
> > {"V-01":"Jack Mort", "V-02":"Roland Deschain", "H-01":"Susannah
> > Holmes"}
> >
> > so i think i'm pretty near but not enough, can you help me?
>
> >
>


-- 
Have a nice day.
Abraham Montilla.

--~--~-~--~~~---~--~~
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] Re: autocomplete in symfony and doctrine

2009-09-22 Thread Romain de Wolff

Hello,

I'm currently facing the same problem.

Does anyone have a solution, an idea or even better, a solution to
propose?

Thanks,

Romain

On 11 sep, 00:38, Abraham  wrote:
> Hello folks, i'm trying to add an autocomplete field in a form, to do
> that i've followed the Make your choice! tutorial:
>
> http://www.symfony-project.org/blog/2008/10/14/new-in-symfony-1-2-mak...
>
> and used the Doctrine autocompleter yet-to-be-released-class:
>
> http://trac.symfony-project.org/attachment/ticket/6012/sfWid
> getFormDoctrineJQueryAutocompleter.class.php
>
> to substitute the Propel class used in the tutorial, but when i type
> something in the widget no autocompletion box appears... I even tried
> using just the sfWidgetFormJQueryAutocompleter (wich is supposed to
> just get the IDs from the foreign table instead of any attribute you
> want) but nothing.
>
> i'm trying to adapt the autocompletion in an admin module, i can see
> the javascript embedded in the source code of the generated page but
> no box shows up... also i wrote directly in the address bar "localhost/
> myApp_dev.php/myModule/autocomplete" (having the executeAutocomplete
> action y actions.class.php), and a file 'autocomplete' can be
> downloaded, the content of the file is the array that
> executeAutocomplete returns, in my case:
>
> {"V-01":"Jack Mort", "V-02":"Roland Deschain", "H-01":"Susannah
> Holmes"}
>
> so i think i'm pretty near but not enough, can you help me?

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