Hi,

I encountered a similar problem before, and I was able to find a
solution because people in the IRC were kind enough to help me. =)
I'm sharing my solution:

                <validator class="or" required="true">
                        <validator class="number" required="false"
provides="foobar">
                                <argument>mycheckbox</argument>
                        </validator>

                        <validator class="set" required="false">
                                <ae:parameter
name="export">mycheckbox</ae:parameter>
                                <ae:parameter name="value">0</ae:parameter>
                        </validator>
                </validator>

                <validator class="MyValidator" depends="foobar">
                        <arguments>
                                <argument>sometextbox</argument>
                        </arguments>
                        <errors>
                                <error>Somethingsomething already
exists.</error>
                        </errors>
                </validator>

YMMV...

Regards,

[ simon.cpu ]

On Thu, Sep 17, 2009 at 8:18 PM, Khashayar <[email protected]> wrote:
> I have a problem on how to validate on a specific scenario.
> let me describe this way:
> I wrote the entire application with Multilingual support.
> I have a News module with an AddAction inside it, so the user can add an
> original News content
> and if he/she likes, can add translations for that news (based on locales
> added to translation.xml)
> to add a translation, user should check related checkbox for that language
> (i.e French), and in the client side, i'll show that
> part of the form to user to fill.
>
> Here's the problem:
> I need to validate translation fields only if that language checkbox,
> checked on the add news' form.
> I tried different ways, but I couldn't find a solution.
> if I wanna add validator to Add.xml, this won't work, cause i don't have the
> locales and which checkboxes checked.
> if I wanna check this on registerWriteValidator and add validator for each
> sent translations' fields, i don't have access to checkboxes values yet.
> if I wanna check this on validateWrite on the AddAction, the validation
> process has been passed and i don't have the values cause Agavi didn't pass
> the
> unvalidated valuse to me.
>
> Thanks in advanced.
>
> _______________________________________________
> users mailing list
> [email protected]
> http://lists.agavi.org/mailman/listinfo/users
>
>

_______________________________________________
users mailing list
[email protected]
http://lists.agavi.org/mailman/listinfo/users

Reply via email to