Not signed in (Sign In)

Vanilla 1.1.4 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthorwaqs
    • CommentTimeFeb 8th 2008
     
    Hi, I am currently using wForms on my form and it works great but it doesn’t have everything I need such as UK post code validation, I was wondering if there were any plans to add post code validation or if there was any way of using existing post code validation and incorporating it in to the wForms JavaScript.
    • CommentAuthorcedsav
    • CommentTimeFeb 8th 2008
     
    You can use regular expressions to validate specific formats like UK post code.

    <input type="text" class="validate-custom /^([A-PR-UWYZ0-9][A-HK-Y0-9][AEHMNPRTVXY0-9]?[ABEHMNPRVWXY0-9]? {1,2}[0-9][ABD-HJLN-UW-Z]{2}|GIR 0AA)$/" />



    In wForms v3, you can also easily add new validation routines:

    <input type="text" class="validate-ukpostcode" />

    <script type="text/javascript">
    wFORMS.behaviors.validation.rules.isUKPostCode = { selector: ".validate-ukpostcode", check: 'validateUKPostCode' };

    wFORMS.behaviors.validation.messages.isUKPostCode = "Not a valid UK Post Code";

    wFORMS.behaviors.validation.instance.prototype.validateUKPostCode = function(element, value) {
    var regexp = /^([A-PR-UWYZ0-9][A-HK-Y0-9][AEHMNPRTVXY0-9]?[ABEHMNPRVWXY0-9]? {1,2}[0-9][ABD-HJLN-UW-Z]{2}|GIR 0AA)$/;
    return this.isEmpty(value) || regexp.test(value);
    }

    </script>



    wForms v3.0:
    http://wforms.googlecode.com/
    • CommentAuthorepschaffer
    • CommentTimeMar 21st 2008
     
    Forgive me, if this question has been submitted before. I have looked but not found a similar one.

    On the properties tab of each question one can indicate that a question requires an answer and one can choose a rudementary format. I think it should be good if three additional choices could be offered: 1. A format like "9999Aa"
    and 2. A regular expression like: /^[1-9]\d{3}\s[A-Z]{2}$/
    • CommentAuthorepschaffer
    • CommentTimeMar 21st 2008
     
    Oops, I was not ready yet.

    The third option would enable the user to enter a javascript code snippet.
    And while we are at it, may be add a customised error message for that particular question.

    It is just a thought, what do you think?
    • CommentAuthorcedsav
    • CommentTimeMar 27th 2008
     
    Thanks for your suggestion. You can already add a custom javascript validation but we don't have a good documentation for that yet, so that would be the first thing we need to do.