Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Robert Gillman 7 posts 78 karma points
    Mar 30, 2017 @ 07:32
    Robert Gillman
    0

    Validate dynamic fields in Umbraco Forms

    I'm building a rather complex form using Umbraco Forms (v 4.4.2) that requires several repeatable fieldsets which can be added and removed. Each group of fields is created using jQuery using a JSON object which defines input properties such as label, type, placeholder and other attributes. For example:

    [
        {
            "label": "Status",
            "inputType": "text",
            "attributes": "required",
            "columns": 4
        },
        ...
    ]
    

    Which is used to construct that input for each fieldset:

    // Excerpt from much larger script
    ...
    var input = $('<input type="' + input.inputType + '" class="' + label.toLowerCase() + '" id="' + label + '_' + count + '" ' + input.attributes + ' placeholder="' + input.label + '" />');
    ...
    

    I need to be able to validate these dynamic fields in a way that matches Umbraco Forms' implementation of jQuery Validation.

Please Sign in or register to post replies

Write your reply to:

Draft