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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:47:03+00:00 2026-05-28T00:47:03+00:00

in my form <?php class ChangeMyPasswordForm extends sfForm { protected static $labels = array(

  • 0

in my form

<?php

    class ChangeMyPasswordForm extends sfForm {

        protected static $labels = array(
            'password' => 'Your Password',
            'confirm'  => 'Re-enter Password',
        );

        public function configure()
        {   
            $this->setWidgets(array(
                   'password'  => new sfWidgetFormInputPassword(array()),
                 'confirm' => new sfWidgetFormInputPassword(array()),
            ));

            $this->setValidators(array(
                'password' => new sfValidatorPass(),
                 'confirm' => new sfValidatorPass(),
            ));

            $this->validatorSchema->setOption('allow_extra_fields', true); 

            $this->mergePostValidator(
                new sfValidatorSchemaCompare('password', sfValidatorSchemaCompare::EQUAL, 
                    'confirm', array(), array(
                        'invalid'=>'Passwords do not match. Please try again.'
                    )
                )
            );
            $this->widgetSchema->setLabels(self::$labels);   
        }   
    }

in my controller

public function executeMyAccountPassword(sfRequest $request) {
          $this->form = new ChangeMyPasswordForm();
          $this->validated=$request->getParameter('validated');

          $this->form->bind(array(
                  $request->getParameter('password'),
                  $request->getParameter('confirm'),
          ));

          if ($request->isMethod('post')) {
              if ($this->form->isValid()) {
                  $this->validated = true;                  
                  var_dump($this->form->getErrorSchema());              
              } else {
                  var_dump($this->form->getErrorSchema());              
              }
          }
      }

in my view

<?php if ($validated): ?>
<div class="success">
  <b>Success</b>
</div>
<? endif; ?>

<?php if ($form->hasGlobalErrors() || $form->hasErrors()): ?>
<div class="error">
  <b>FAIL !!</b>
  <ul>
    <?php foreach ($form->getGlobalErrors() as $name => $error): ?>
        <li>
            <?php echo $error ?>
        </li>
    <?php endforeach; ?>

    <?php if($form['password']->hasError()): ?>
        <li>
            <?php echo $form['password']->getError() ?>
        </li>
    <?php endif; ?>

  </ul>
</div>
<? endif; ?>

I cant figure out what I’m doing wrong, it doesn’t matter if the passwords match or not, the form always returns success (unless I change the comparison to not equal). How can I tell if the values are making it back to the form ? Am I doing anything obviously wrong ?

  • 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-28T00:47:04+00:00Added an answer on May 28, 2026 at 12:47 am

    Your bind call is off. It needs one or two values, the first one being the submitted values, the second one the files ($request->getFiles()).

    Let’s focus on the first one, as you’re not handling any file uploads.

    It should be an array of all the form’s values In your current situation, you may do it like this (aka. quick-n-dirty fix):

    $this->form->bind(array(
      "password" => $request->getParameter("password"),
      "confirm"  => $request->getParameter("confirm"),
    ));
    

    On the long term, you should make your form appear as an array in $_POST, add this to your configure():

    $this->widgetSchema->setNameFormat("changepasswd[%s]");
    

    This will make your inputs named like changepasswd[password] and changepasswd[confirm]. Binding becomes easy:

    $this->form->bind($request->getParameter($this->form->getName()));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In symfony. . . my form looks like this <?php class ChangeMyPasswordForm extends sfForm
My form class: <?php require_once ('Zend\Form.php'); class Sergio_Form_registrationform extends Zend_Form { public function init(){
Here's my Zend code: <?php require_once ('Zend\Form.php'); class Sergio_Form_registrationform extends Zend_Form { public function
Here's what I'd like: Here's my code: <?php require_once ('Zend\Form.php'); class Sergio_Form_registrationform extends Zend_Form
Controller : <?php class AdminController extends Zend_Controller_Action { public function init() { error_reporting(E_ALL); }
<?php class Form_Audience extends Zend_Form_SubForm { public function init() { $this->setMethod('post'); $this->setLegend('Audience Details'); $this->addElement('text',
Grouped params: <?php class Form { private $field; public function getFieldRelated($field) { return $this->fieldrelated[$field];
I have two php files: main.class.php form.class.php in these files there are two class
Is it possible to send form data to a PHP class' method rather than
I got RegisterController.php and inside of it I got: class RegisterController extends AppController {

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.