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 4540106
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T15:02:24+00:00 2026-05-21T15:02:24+00:00

I have an embeddedForm that I am trying to configure the widgets for. Currently

  • 0

I have an embeddedForm that I am trying to configure the widgets for.

Currently I am just outputting the form in a _form.php template like:

<?php echo $form ?> 

This is great, but I’d like to have my form fields in a particular order, so I thought I’d try:

<?php echo $form['firstname']->renderRow() ?> 
<?php echo $form['lastname']->renderRow() ?> 
<?php echo $form['email_address']->renderRow() ?> 

This gives me an invalid widget error.

Now I have 2 forms, one is a basic form, that simply embeds another form.

<?php
class labSupportForm extends sfGuardUserAdminForm
{
   public function configure()
   {
     $form = new labSupportProfileForm($this->getObject()->getProfile());
     $this->embedForm('profile', $form);

   unset($this['is_super_admin'], $this['is_admin'], $this['permissions_list'], $this['groups_list']);

   $this->widgetSchema['profile'] = $form->getWidgetSchema();
   $this->validatorSchema['profile'] = $form->getValidatorSchema();
 }

 public function save($con = null)
 {
   $user = parent::save($con);
   if (!$user->hasGroup('Lab Support'))
   {
     $user->addGroupByName('Lab Support');
     $user->save();
   }
   return $user;
 }
}

and:

<?php
class labSupportProfileForm extends sfGuardUserProfileForm
{
  public function configure()
  {
    unset($this['email_new'],
          $this['validate_at'],
          $this['validate'],
          $this['address_1'],
          $this['address_2'],
          $this['city'],
          $this['country'],
          $this['postcode'],
          $this['created_at'],
          $this['updated_at'],  
          $this['user_id'],   
          $this['is_super_admin'], 
          $this['is_admin'], 
          $this['permissions_list'], 
          $this['groups_list']);
   }
}

But If I add the widget/validator to the labSupportForm and save, the firstname value doesn’t save.

Am I doing something wrong here, as I would have thought this value would save.

Thanks

  • 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-21T15:02:25+00:00Added an answer on May 21, 2026 at 3:02 pm

    When you render a form by fields, you have to explicitly call $form->renderHiddenFields(). For example:

    <?php echo form_tag_for($form, '@url') ?>
      <table>
        <tfoot>
          <tr>
            <td colspan="2">
              <input type="submit" value="Save" />
              <?php echo $form->renderHiddenFields() ?>
            </td>
          </tr>
        </tfoot>
        <tbody>
          <?php echo $form['username']->renderRow() ?>
          <?php echo $form['profile_form']->renderRow() ?>
        </tbody>
      </table>
    </form>
    

    Also, beware calling embedded form name the same as relation name (e.g. ‘profile’) or you will have troubles when saving it. Just add ‘_form’ suffix and you will be safe:

    $this->embedForm('profile_form', $form);
    

    If you want to keep a linear display structure of your form fields, you should render them explicitly according to your widget schema:

          <?php echo $form['username']->renderRow() ?>
          <?php echo $form['profile_form']['first_name']->renderRow() ?>
          <?php echo $form['profile_form']['last_name']->renderRow() ?>
    

    Or you can do it automatically for all fields of an embedded form:

        <?php foreach ($form['profile_form'] as $field): ?>
          <?php if (!$field->isHidden()): ?>
            <?php echo $field->renderRow() ?>
          <?php endif; ?>
        <?php endforeach; ?> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have a SomeLib.pro file that contains: CONFIG += debug TEMPLATE = lib TARGET =
Im trying to create a custom formatter in Symfony 1.4. I have embedded form
I have an embedded form with a choice widget. I'm trying to pass a
I have a form that embeds another form: <form> <input type=text name=main[name]> <textarea name=main[body]></textarea>
I have a form 'ChallengeType'. Which has these fields: 1) Embedded form team1 input
Have a matrix report now that has Position, Hours and Wages for a location
I have a pair of tables that have a one-to-one relationship. I have a
I have a symfony 1.4 form with 2 embedded forms. The parent form has
have been trying couple of hours now to make my iphone app universal. The
Have a look at one of my websites: moskah.com The problem is that it

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.