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

  • SEARCH
  • Home
  • 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 334813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T10:05:24+00:00 2026-05-12T10:05:24+00:00

I am running Symfony 1.2 and utilizing the object helper to create some inline

  • 0

I am running Symfony 1.2 and utilizing the object helper to create some inline editable fields outside of a form. Because there is no symfony or scriptalicious short cut to create an inline edit tag for multiple choice select boxes (much like input_in_place_editor_tag or Ajax.InPlaceCollectionEditor), I am using object_select_tag with the multiple option set to true to create a select box like so:

<?php      
  echo object_select_tag($user->getsfGuardPermissions(), 'getId', array (
 'include_blank' => false,
 'related_class' => 'sfGuardPermission',
 'peer_method' => 'doSelect',
 'text_method' => '__toString',
 'control_name' => 'user_customer_permissions_'.$user_customer->getId(),
     'multiple' => true
));
?>

I will then call observe_field to update the object via Ajax when the form is changed. However

The problem is that while $user->getsfGuardPermissions() returns an array of sfGuardPermission objects. They are not selected by default.

After some testing, I found that if you pass it only one sfGuardPermission object instead of an array, the proper option is selected. Is this a limitation of Symfony or is there a different way of doing this? It’s hard to believe that symfony would include the ‘multiple’ option if they didn’t allow you to select multiple options by default.

Looking at ObjectHelper.php it is apparent that the function is not expecting an array. How do I select multiple objects by default?

  • 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-05-12T10:05:25+00:00Added an answer on May 12, 2026 at 10:05 am

    object___select ___tag() will accept an integer array corresponding to the object values you want selected. For example:

    <?php
      echo object_select_tag(array(4, 5), 'getId', array (
     'include_blank' => false,
     'related_class' => 'sfGuardPermission',
     'peer_method' => 'doSelect',
     'text_method' => '__toString',
     'control_name' => 'user_customer_permissions_'.$user_customer->getId(),
         'multiple' => true
    ));
      ?>
    

    Will select values 4 and 5 by default. This is not ideal, as the documentation lists the first parameter as $object object select tag (symfony API). So I suppose this can be considered a workaround. Ideally the function would accept an array of objects for the $object parameter when the multiple flag is set to true. This would be consistent with other helper functions.

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

Sidebar

Ask A Question

Stats

  • Questions 165k
  • Answers 165k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Categories extend the original class, but they don't subclass it,… May 12, 2026 at 12:54 pm
  • Editorial Team
    Editorial Team added an answer Haven't tested this, but it's something like: RewriteRule \.php$ -… May 12, 2026 at 12:54 pm
  • Editorial Team
    Editorial Team added an answer "0:0:0:0:0:0:0:1" is the IPv6 loopback address as defined in RFC… May 12, 2026 at 12:54 pm

Related Questions

I am currently developing a system on a server running PHP version 5.1.6 thus
I have some functions that use curl to pull information off a couple of
I am running oracle and have a query which pulls some results from the
I am running a Tomcat application, and I need to display some time values.
I am running OS X 10.5, Ruby 1.8.6, Rails 2.1, sqlite3-ruby 1.2.2 and I

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.