INPUT Validation - CURRENCY, TOO

by bizamajig

HTML

<script src="http://cdn-na.infragistics.com/jquery/20121/2049/js/infragistics.loader.js"></script>
<h2>Controlling input and helping the user get there</h2>
<fieldset>
    <legend>Default input restriction to numbers (and some special signs)</legend>
    <p>Numeric Input:</p>
    <input name="numeric"/>
    <br />
    <p>Currency Input with set minimal value to 0: </p>
    <input name="currency"/>
    <br />
    <p>Percent editor, min value -100, maximum value: -1: </p>
    <input name="percent"/>
    <br />
    <p>Date input(input field is also the same with the igDatePicker): </p>
    <input name="date">
</fieldset>
<fieldset>
    <legend>Toggling input active state:</legend>
    <br />
    <input id="toggleInput"/>
    <input type="checkbox" checked="checked">
</fieldset>
<fieldset>
    <legend>Masks:</legend>
    <br />
    <label>phone: </label>
    <input id="phoneMask"/>
    <label>name: </label>
    <input id="nameMask"/>
</fieldset>
<fieldset>
    <legend>Validation:</legend>
    <br />
    <label>name: </label>
    <input id="nameMask2"/>
    <br />
    <label>quantity per unit: </label>
    <input id="quantity"/>
    <label>email: </label>
    <input id="email"/>
</fieldset>

JavaScript

$.ig.loader({
    scriptPath: "http://cdn-na.infragistics.com/jquery/20121/2049/js",
    cssPath: "http://cdn-na.infragistics.com/jquery/20121/2049/css",
    resources: "igEditors,igValidator"
});
$.ig.loader(function() {

    $("input[name='numeric']").igNumericEditor();

    $("input[name='currency']").igCurrencyEditor({
        minValue: 0
    });

    $("input[name='percent']").igPercentEditor({
        minValue: -100,
        maxValue: -1
    });

    $("input[name='date']").igDateEditor();

    $("#toggleInput").igNumericEditor();

    $("#phoneMask").igMaskEditor({
        inputMask: "(999) 999-9999"
    });

    $("#nameMask").igMaskEditor({
        inputMask: ">L>L?????????????????"
    });

    $("#nameMask2").igMaskEditor({
        inputMask: ">L>L?????????????????",
        validatorOptions: {
            errorMessage: "Should be atleast two letters long. <br><em>Example: Jo </em>"
        }
    });

    $("#quantity").igTextEditor({
        validatorOptions: {
            // need the  input to start with a number (quantity) and also contain e measure unit (word)
            regExp: /\b[0-9]+ \b[A-z]/,
            errorMessage: "Should contain a numerical value for quantity, followed by space and a measuring unit. <br><em>Example: 20 kg </em>"
        }
    });

    $("#email").igTextEditor({
        validatorOptions: {
            regExp: /\b[A-z0-9._]+@[A-z0-9.\-]+\.[A-z]{2,4}\b/
        }
    });
});

$('input[type=checkbox]').change(function(evt) {
    $('#toggleInput').igNumericEditor("option", "disabled", !evt.target.checked);
});