View on GitHub

Parsely-conditions

A jQuery plugin that adds conditional logic to the Parsely.js form validation library

Download this project as a .zip file Download this project as a tar.gz file

< Back to home

Multiple Condition on the Same Input

This example shows how you can apply multiple conditions to a single input. In this example if you check off fruit cake or ice cream different things happen. Multiple conditions have been applied to the checklist to get this result.

Select the desserts you like:
Cheeze Cake
Apple Pie
Fruit Cake
Fruit cake? SERIOUSLY?!?
Ice Cream
What flavour of ice cream?


Here's the plugin code used for this example.

var fValidate = $.parselyConditions({
        formname: 'customForm',
        validationfields: [
            {
                fid: 'formTrigger',
                ftype: 'checklist',
                fvalue: 'Fruit Cake',
                faffected: false,
                fhide: 'warning'
            },
            {
                fid: 'formTrigger',
                ftype: 'checklist',
                fvalue: 'Ice Cream',
                faffected: 'flavour',
                fhide: 'maskDiv'
            },

        ],
    });