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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:22:19+00:00 2026-05-24T21:22:19+00:00

I’ve built the following form based on the Symfony tutorial. UsersForm.class.php: class UsersForm extends

  • 0

I’ve built the following form based on the Symfony tutorial.

UsersForm.class.php:

class UsersForm extends BaseUsersForm
    {
      public function configure()
      {
        $this->useFields(array('username', 'password', 'email', 'tara', 'gen'));
        $this->widgetSchema['password'] = new sfWidgetFormInputPassword();
        $this->widgetSchema['email'] = new sfWidgetFormInputText();
        $this->validatorSchema['email'] = new sfValidatorAnd(array(
            $this->validatorSchema['email'],
            new sfValidatorEmail(),
        ));
        $this->widgetSchema['tara'] = new sfWidgetFormChoice(array(
            'choices'  => Doctrine_Core::getTable('Users')->getTara(),
                'expanded' => false,
            'multiple' => false,
        ));
        $this->validatorSchema['tara'] = new sfValidatorChoice(array(
            'choices' => array_keys(Doctrine_Core::getTable('Users')->getTara()),
        ));
        $this->widgetSchema['gen']= new sfWidgetFormChoice(array(
            'choices'  => Doctrine_Core::getTable('Users')->getGen(),
            'expanded' => false,
            'multiple' => false,
        ));
        $this->validatorSchema['gen'] = new sfValidatorChoice(array(
            'choices' => array_keys(Doctrine_Core::getTable('Users')->getGen()),
        ));
        $this->widgetSchema->setLabels(array(
            'username'    => 'Utilizator',
            'password'    => 'Parolă',
            'email'       => 'Adresă de email',
            'tara'        => 'Ţara',
        'gen'         => 'Gen',
        ));
        $this->setValidators(array(
            'username' => new sfValidatorString(array('min_length' => 4),
                    array('required' => 'Câmp obligatoriu',
                    'min_length' => 'Minim %min_length% caractere.',)),
            'password' => new sfValidatorString(array('min_length' => 4),
                    array('required' => 'Câmp obligatoriu',
                        'min_length' => 'Minim %min_length% caractere.',)),
        ));
        $this->widgetSchema['captcha'] = new sfWidgetFormReCaptcha(array(
            //'public_key' => sfConfig::get('app_recaptcha_public_key')
            'public_key' => '/*...*/'
        ));

        $this->validatorSchema['captcha'] = new sfValidatorReCaptcha(array(
            //'private_key' => sfConfig::get('app_recaptcha_private_key')
        'private_key' => '/*...*/'
        ));
      }
    }

Actions.class.php:

public function executeCreate(sfWebRequest $request)
{
    $this->setLayout(false);
    $this->form = new UsersForm();
    $this->processForm($request, $this->form);
}
public function executeRegister(sfWebRequest $request)
{
    $this->setLayout('register');
    $this->form = new UsersForm();
    $this->setTemplate('register');
}
protected function processForm(sfWebRequest $request, sfForm $form)
{
    $captcha = array(
        'recaptcha_challenge_field' => $request->getParameter('recaptcha_challenge_field'),
        'recaptcha_response_field'  => $request->getParameter('recaptcha_response_field'),
    );
    $form->bind(array_merge(
        $request->getParameter($form->getName()),
        array('captcha' => $captcha)));

    if ($form->isValid())
    {
        $user = $form->save();

        $this->redirect('/');
    }
}

Routing.yml:

register_create:
  url:     /register.:sf_format
  class:   sfDoctrineRoute
  options: { model: Users, type: object }
  param:   { module: home, action: register, sf_format: html }
  requirements: { sf_method: post }

register_new:
  url:     /register.:sf_format
  class:   sfDoctrineRoute
  options: { model: Users, type: object }
  param:   { module: home, action: register, sf_format: html }

Although the errors are not displayed nor the database is updated. It’s more like a refresh when I submit the form.

I am -very- newbie in Symfony and I can’t find the error myself.

LE:

_form.php:

<?php use_stylesheets_for_form($form) ?>
<?php use_javascripts_for_form($form) ?>

<?php echo form_tag_for($form, '@register') ?>
  <table id="register_form">
    <tfoot>
      <tr>
        <td colspan="2">
          <input type="submit" value="Înregistrează-te" />
        </td>
      </tr>
    </tfoot>
    <tbody>
        <?php echo $form ?>
    </tbody>
  </table>
</form>

registerSuccess.php:

<?php include_partial('form', array('form' => $form)) ?>
  • 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-24T21:22:20+00:00Added an answer on May 24, 2026 at 9:22 pm

    The form is likely throwing an error that is not getting rendered. Try including this debug code in your BaseForm class (lib/form/BaseForm.class.php) and seeing what output you get when you call it in the view.

    public function debug()
    {
      if (sfConfig::get('sf_environment') != 'dev')
      {
        return;
      }
      foreach($this->getErrorSchema()->getErrors() as $key => $error)
      {
        echo '<p>' . $key . ': ' . $error . '</p>';
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
public static bool CheckLogin(string Username, string Password, bool AutoLogin) { bool LoginSuccessful; // Trim
I need a function that will clean a strings' special characters. I do NOT
I want to construct a data frame in an Rcpp function, but when I
I'm trying to create an if statement in PHP that prevents a single post

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.