Conditions for validating fields

23 views
Skip to first unread message

Quest

unread,
May 16, 2013, 10:03:11 AM5/16/13
to mootool...@googlegroups.com
Hey there,

I have a form with some input fields and checkboxes.
If a specific checkbox is checked, I need some additional fields to become required.
So I thought 'validate-enforce-oncheck' would be perfect for me.

Another Problem is, that I have 2 checkboxes from which the customer has to select at least one. I tried to do this with validate-reqchk-bynode
But it seems not to be recognized if 1 of the boxes is checked. the validation-failed CSS Class remains on both inputs

I hope anyone can help me.
This is the HTML-Code I tried to do this with:

    <div id="checkOne">
        <div class="c3 break">
            <div class="control" id="contact_partner">
                <div class="checkbox">
                    <input type="checkbox" name="contact_partner" value="Ja" data-validators="validate-reqchk-bynode nodeId:'checkOne' validate-ignore-oncheck toIgnore:['email','phone']" class="" />
                </div>
                <label>
                    Lorem Ipsum
                </label>
            </div>
        </div>
        <div class="c3 break">
            <div class="control" id="order_infomaterial">
                <div class="checkbox">
                    <input type="checkbox" name="order_infomaterial" value="Ja" data-validators="validate-reqchk-bynode nodeId:'checkOne'" />
                </div>
                <label>
                    Lorem Ipsum
                </label>
            </div>
        </div>
    </div>
    <div class="c2">
        <div class="control">
            <label for="phone">Telefon</label>
            <div class="string">
                <input type="text" id="phone" name="phone" value="" data-validators="required" />
            </div>
        </div>
    </div>
    <div class="c2">
        <div class="control">
            <label for="email">E-Mail</label>
            <div class="string">
                <input type="text" id="email" name="email" value="" data-validators="required" />
            </div>
        </div>
    </div>
Reply all
Reply to author
Forward
0 new messages