Re: DB_DataObject_FormBuilder & HTML_QuickForm questions with ArraySmarty renderer
| From: | Justin Patrin | Date: | Fri, 02 Sep 2005 17:44:59 +0000 |
| Subject: | Re: DB_DataObject_FormBuilder & HTML_QuickForm questions with ArraySmarty renderer | ||
| References: | 1 2 3 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-39698@lists.php.net to get a copy of this message | ||
On 8/29/05, Markus Fischer <markus@fischer.name> wrote:
> Hi Justin,
>
> Justin Patrin wrote:
> > On 8/24/05, Markus Fischer <markus@fischer.name> wrote:
> >>* Custom validation rule for fields which are "not null"
> >>We've had all "required" fields for the form submission of type
> >>"not
> >>null". However in this case we were not able to override the default
> >>error message ("This field is required"). Calling addRule() simply
> >>didn't change anything. Our solution was to change the database to be
> >>"null" and then our custom rule was accepted. We mainly needed the
> >>custom rules for translated error messages.
> >
> > See:
> > http://opensource.21st.de/23.html#A17
>
> Your advice is to set an option to the FormBuilder to use a customized
> required message with requiredRuleMessage.
>
> Am I wrong that this applies to all required messages?
>
> Consider the current problem we're facing:
>
> We have a profile for the user to update. The user has two fields
> "password" and "verify password". If the user just wants update his
> profile, his password is NOT requred.
>
> But, if he wants to change his password, he MUST provide it two times.
>
> Again we're using custom callback handlers here. Problem: if the field
> "password" is filled out and the field "verify password" has NO value,
> the callback of "verify password" is not executed.
>
> Why are custom rules for fields not executed if the field is "not
> required" and empty?
>
> And how can we work around this issue?
>
I'm still not sure how your'e doing this. How are you setting up your
custom rule? If you make it a form rule it will always be called. For
something like this where fields are conditionally required I would
suggest a form rule.
--
Justin Patrin