Ticket #833 (closed defect: fixed)

Opened 4 months ago

Last modified 4 months ago

AgaviEqualsValidator's docs do not match the actual validation process

Reported by: morkai@… Owned by: dominik
Priority: normal Milestone: 0.11.3
Component: validation Version: 1.0.0beta1
Severity: normal Keywords: validation AgaviEqualsValidator asparam
Cc: Patch attached: yes

Description (last modified by david) (diff)

The doc comment of AgaviEqualsValidator states:

 * When the parameter 'asparam' is true, the content in 'value' is taken as a
 * parameter name and the check is performed against it's value otherwise the
 * content in 'value' is taken.

but the process() method doesn't use the asparam at all.

To make it work currently, one has to write:

<validator class="equals">
  <arguments>
    <argument>password2</argument>
    <argument>password</argument>
  </arguments>
  <error>Passwords do not match</error>
</validator>

but when validation fails, error message is added to both fields.

With attached patch, one can write:

<validator class="equals">
  <argument>password2</argument>
  <parameters>
    <parameter name="value">password</parameter>
    <parameter name="asparam">true</parameter>
  </parameters>
  <error>Passwords do not match</error>
</validator>

and error message will be added only to the field(s) specified as argument(s).

Attachments

AgaviEqualsValidator.class.php.patch (0.7 KB) - added by morkai 4 months ago.
Patch to make asparam parameter work in AgaviEqualsValidator?.

Change History

Changed 4 months ago by morkai

Patch to make asparam parameter work in AgaviEqualsValidator?.

Changed 4 months ago by david

  • description modified (diff)

Changed 4 months ago by dominik

  • status changed from new to closed
  • resolution set to fixed

(In [2750]) readd asparam parameter to the equalsvalidator fixes #833

Add/Change #833 (AgaviEqualsValidator's docs do not match the actual validation process)

Author



Action
as closed
Next status will be 'reopened'
 
Note: See TracTickets for help on using tickets.