[symfony-users] sfWidgetFormChoice

2011-01-14 Thread sinu govind
Hi all,

I have the following in my schema.yml

title:
  type: enum
  length: 2
  values: [Mr, Ms]
  default: Mr

In my databases.yml, I have given
 attributes:
use_native_enum: true

In my registration form, I have

$this-setWidget('title',
new sfWidgetFormChoice (array('choices' = array ('Mr',
'Ms'),'expanded' = true
)));
$this-setDefault('title', 0);

But my selection does not get posted to the database. In the database the
title field is an enum with values 'Mr'  'Ms.' and the default value is set
as 'Mr'.

So whenever I select a new record, the default value 'Mr' is
inserted..PLease help!!!

Sinu

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


Re: [symfony-users] sfWidgetFormChoice

2011-01-14 Thread Gareth McCumskey
What does your action and template look like where you use the form?

On Thu, Jan 13, 2011 at 2:25 PM, sinu govind sinugov...@gmail.com wrote:

 Hi all,

 I have the following in my schema.yml

 title:
   type: enum
   length: 2
   values: [Mr, Ms]
   default: Mr

 In my databases.yml, I have given
  attributes:
 use_native_enum: true

 In my registration form, I have

 $this-setWidget('title',
 new sfWidgetFormChoice (array('choices' = array ('Mr',
 'Ms'),'expanded' = true
 )));
 $this-setDefault('title', 0);

 But my selection does not get posted to the database. In the database the
 title field is an enum with values 'Mr'  'Ms.' and the default value is set
 as 'Mr'.

 So whenever I select a new record, the default value 'Mr' is
 inserted..PLease help!!!

 Sinu



  --
 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.comsymfony-users%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/symfony-users?hl=en




-- 
Gareth McCumskey
http://garethmccumskey.blogspot.com
twitter: @garethmcc
identi.ca: @garethmcc

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


Re: [symfony-users] sfWidgetFormChoice

2011-01-05 Thread Gareth McCumskey
What version of symfony are you using? sfWidgetFormChoice only exists for
symfony 1.4.

On Wed, Dec 29, 2010 at 6:58 PM, emanu.ti emanu...@gmail.com wrote:

 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.comsymfony-users%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/symfony-users?hl=en




-- 
Gareth McCumskey
http://garethmccumskey.blogspot.com
twitter: @garethmcc

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


Re: [symfony-users] sfWidgetFormChoice

2011-01-05 Thread Emmanuel
symfony 1.4.8. On this message i post how i solved my problem.

Hi, i solved my problem puting this code in my model:

public function setMyField ($value)
{
 $this-_set(my_field, implode(|, $value));
}

public function getMyField ()
{
 $tmp = explode(|,$this-_get(my_field));
 $values = array();
 foreach ($tmp as $t)  { $values[$t] = $t }
 return $values;
}

On Wed, Jan 5, 2011 at 5:16 PM, Gareth McCumskey gmccums...@gmail.comwrote:

 What version of symfony are you using? sfWidgetFormChoice only exists for
 symfony 1.4.


 On Wed, Dec 29, 2010 at 6:58 PM, emanu.ti emanu...@gmail.com wrote:

 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.comsymfony-users%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/symfony-users?hl=en




 --
 Gareth McCumskey
 http://garethmccumskey.blogspot.com
 twitter: @garethmcc

  --
 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.comsymfony-users%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/symfony-users?hl=en




-- 
Emmanuel - 8402 - 3552

-- 
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] sfWidgetFormChoice and setDefault

2010-09-10 Thread torok84
I have this code in a doctrine form

$this-widgetSchema['priority'] = new sfWidgetFormChoice(
array(
'choices' = $pri_choices
));
var_dump($pri_choices);
echo max(array_keys($pri_choices));
$this-widgetSchema['priority']-
setDefault( max(array_keys($pri_choices)) );


the output is
array
  100 = string 'Problematica' (length=12)
  200 = string 'Informazione' (length=12)
200

I would expect to get the Informazione entry selected, while the HTML
output is

select name=question[priority] id=question_priority
option value=100 selected=selectedProblematica/option
option value=200Informazione/option
/select

It seems a bug, or am I missing something?

Thanks
Paolo

-- 
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 with custom query slower than sfWidgetFormPropelChoice generated by default

2010-09-06 Thread Hugo Chinchilla
Hi,

for my app's backend I have written a custom method to draw a select
widget which was consuming a lot of memory to generate.

The default form generated a select widget from the model populating
full objects just to render an options list which only needs a PK and
a string, so I wrote a method which generates a new sfWidgetFormChoice
and fills it with choices from a custom query which retrieves only 3
columns, the PK and other 2 to compose the option name.

The memory consumption is now 20M less than the original, but the time
it takes to generate the page has increased from 600ms to more than 3
seconds. The time profiler in the debugbar shows that all this extra
time happens on the rendering of the form.

I can't understand this behaviour because the sfWidgetFormPropelChoice
extends sfWidgetFormChoice, so the rendering is the same, the only
difference is the way in with the $choices array is generated

-- 
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-06-15 Thread Joe
I am working on a module generated by the admin generator. I added the
sfWidgetFormChoice widget to the lib/form file, like this :

class MyModule extends BaseMyModule
{
public function configure()
{
$this-widgetSchema['field'] = new sfWidgetFormChoice (array(
 'choices' = array ('Choice1', 'Choice2')
));
}
}

My problem is that the choices are converted to '0' and '1' before
Insert(). I would like to insert the values of 'choices' (in this case
Choice1 and Choice2).

Help would be appreciated. I hope I am clear enough.

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


Re: [symfony-users] sfWidgetFormChoice

2010-06-15 Thread Gábor Fási
choices = array(
  choice1 = choice1,
  choice2 = choice2,
);

On Tue, Jun 15, 2010 at 10:24, Joe joe.hakim.ra...@gmail.com wrote:
 I am working on a module generated by the admin generator. I added the
 sfWidgetFormChoice widget to the lib/form file, like this :

 class MyModule extends BaseMyModule
 {
    public function configure()
    {
        $this-widgetSchema['field'] = new sfWidgetFormChoice (array(
                 'choices' = array ('Choice1', 'Choice2')
        ));
    }
 }

 My problem is that the choices are converted to '0' and '1' before
 Insert(). I would like to insert the values of 'choices' (in this case
 Choice1 and Choice2).

 Help would be appreciated. I hope I am clear enough.

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


-- 
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 rendered as an unordered list

2010-03-25 Thread HiDDeN
Hello.

Is there some way to render a sfWidgetFormChoice as an unordered list?

In the API there is an option called 'renderer_class' but I can't find
any documentation or example about it.

Thanks!

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

To unsubscribe from this group, send email to 
symfony-users+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


[symfony-users] sfWidgetFormChoice and Foreign keys problems!

2010-02-01 Thread wueb
Hi.

I'm having 2 problems and i though someone here could help me.

1st PROBLEM:

I have a widget called id_empresa which is a sfWidgetFormChoice with
multiple choices, like this:

$this-widgetSchema['id_empresa'] = new sfWidgetFormChoice(
array(
  'choices'  = $empresas,
  'expanded' = false,
  'multiple' = true
),
array(
  'size' = $size
)
);

And when i submit the form where the widget is, i can't get any value
from the select box even with all the options selected. It returns me
always null.

//form
public function updateObject($values = null)
{
 print_r($this-id_empresa);   //output  = null !!
}

--

2nd PROBLEM

In my template i have this:

 tr
  tdCreated by/td
  td?php echo $info_empresa-getCreatedBy() ?/td
  tdUpdated by/td
  td?php echo $info_empresa-getUpdatedBy() ?/td
 /tr

My point is get something like :

 tr
  tdCreated by/td
  td?php echo $info_empresa-getUsers()-getUsername() ?/td
  tdUpdated by/td
  td?php echo $info_empresa-getUsers()-getUsername()  ?/td
 /tr

But they are both foreign keys from same fields, how does the symfony
knows what Username get?? The CreatedBy and UpdatedBy are IDs and can
be from different users.

-- 
You received this message because you are subscribed to the Google Groups 
symfony users group.
To post to this group, send email to symfony-us...@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

2009-08-27 Thread mattsister

I have a TINYINT column in my db that represent the month. In the
filter section of my backend I want a select instead of an input text.
So I made this in my filter class:

$mese_choices = array(
  '' = 'Tutti i mesi',
  1  = 'Gennaio',
  2  = 'Febbraio',
  3  = 'Marzo',
  4  = 'Aprile',
  5  = 'Maggio',
  6  = 'Giugno',
  7  = 'Luglio',
  8  = 'Agosto',
  9  = 'Settembre',
  10 = 'Ottobre',
  11 = 'Novembre',
  12 = 'Dicembre'
);

$this-setWidget('mese', new sfWidgetFormChoice(array('choices' =
$mese_choices)));
$this-setValidator('mese', new sfValidatorChoice(array('choices'
= array_keys($mese_choices;


Everything seems fine, when I choose a month from the dropdown and
press filter no errors pop up. But for some strange reason the list
is not filtered. The dropdown is completely ignored. I've inspected
the queries generated and anything related to the month column shows
up...

Any idea?

--~--~-~--~~~---~--~~
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 and empty value

2009-03-04 Thread Paolo Mainardi
Why doesn't exist an option for setting an empty value on this Widget ?

I'm going crazy!

Cheers

-- 
Paolo Mainardi

Vice Presidente Assoc.ILDN (http://www.ildn.net)
Blog: http://www.paolomainardi.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
-~--~~~~--~~--~--~---