Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9150235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:35:09+00:00 2026-06-17T11:35:09+00:00

I have a table with items in the following: id | value 1 |

  • 0

I have a table with items in the following:

id | value
 1 |  12
 2 |  14
 3 |  16

I’m using a sfWidgetFormDoctrineChoice widget which has the following:

  $this->widgetSchema['value'] = new sfWidgetFormDoctrineChoice(array(
        'model'=>'TemplateFontSize',
        'add_empty'=>'Please Select Font Size', 
        'expanded' => false, 'multiple' => false
  ));

This outputs the following in HTML

<select>
  <option value="1">12</option>
  <option value="2">14</option>
  <option value="3">12</option>
</select>

Ideally though I’d like the value="" value to to be the value, i.e

<select>
  <option value="12">12</option>
  <option value="14">14</option>
  <option value="16">12</option>
</select>

Is this possible in the widget?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T11:35:09+00:00Added an answer on June 17, 2026 at 11:35 am

    Use key_method param in your widget configuration.

    The method to use to display the object keys (getPrimaryKey by default)

    $this->widgetSchema['value'] = new sfWidgetFormDoctrineChoice(array(
      'model'      =>'TemplateFontSize',
      'key_method' =>'getValue',
      'add_empty'  =>'Please Select Font Size', 
      'expanded'   => false,
      'multiple'   => false
    ));
    

    See more here.


    UPDATE: you’ll also need to do something similar to the validator. By default it expects the PK as the submited value. You need to “tell” it that it should expect another column. Something like (haven’t tested):

    $this->validatorSchema['value'] = new sfValidatorDoctrineChoice(array(
      'model'      =>'TemplateFontSize',
      'column'     => 'value'
    ));
    

    More here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a following table using MVC that shows number of items the user
Using MVC3 I am trying to accomplish the following. I have a table which
I have the following table, which represents valuations of items. ITEM REFERENCEDATE VALUATION ------------------------------------------------
I have a table of items. item has id, score 1, score 2. I
I have a table of items stored this way : A1 | B1 A1
i have this MainViewController, which is a controller for my table view. Whenever I
I have a table which has columns of data that contain status. Two example
I'm starting out using the Zend Framework and have created a suitable model which
I have a table of items by date (each row is a new date).
I have a Hierarchical Table for Categories in this form NodeID ParentID NodeName Following

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.