More info:

The same widget, generated with sfWidgetFormDoctrineChoice without passing
any method for filtering (Notice it has one more value, of course because it
is not filtered, but the value = id):

<select id="rule_new_campaign_id" name="rule[new][campaign_id]">
<option selected="selected" value=""/>
<option value="341">Special Sale</option>
<option value="491">30 Off</option>
<option value="903">20 Off Code</option>
<option value="938">20 Off</option>
</select>

Same field as above but using: = new sfWidgetFormChoice(array('choices'
=>Doctrine::getTable('Campaign')->getCampaigns(sfContext::getInstance()->getUser()->getGuardUser()->Organization)));

<select id="rule_campaign_id" name="rule[campaign_id]">
<option value="0">Special Sale</option>
<option value="1">30 Off</option>
<option value="2">20 Off Code</option>
</select>

Notice it does filter based on the method, of course, but the value= is now
just a 0 index.. no the actual id.

Any ideas?  This gives me tons of errors of course...





On Fri, Mar 5, 2010 at 7:10 PM, Samuel Morhaim <samuel.morh...@gmail.com>wrote:

> I have a question, I have a dropdown that needs to be populated from the
> database, but with a query, and the query is based on a post variable.
>
> I know that sfWidgetFormDoctrineChoice has an option for passing a method,
> but I can't pass a method + parameter like that.
>
> So I used the simple sfWidgetFormChoice with the choice value being the
> Doctrine getTable  and the parameter..  as shown in the bottom of this
> email..  HOWEVER, the dropdown is not well populated.  The dropdown is
> formed like this:
>
> <option value="0">20 Off Code</option>
> <option value="1">Special Sale</option>
> <option value="2">30 Off</option>
>
> This is incorrect, since the value for 20 Off Code is not 0 , is actually
> 1  so the index is wrong.
>
>     $this->widgetSchema['campaign_id'] = new sfWidgetFormChoice(array
>         (
>             'choices' =>
> Doctrine::getTable('Campaign')->getCampaigns(sfContext::getInstance()->getUser()->getGuardUser()->Organization)
>         ));
>
>
> What can I do ?
>
> Thank you.
>
>

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

Reply via email to