How to use the oc.fieldName function in oc

To help you get started, we’ve selected a few oc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ivandoric / Making-Websites-With-October-CMS / plugins / rainlab / builder / formwidgets / formbuilder / assets / js / formbuilder.domtopropertyjson.js View on Github external
if (!listItem.hasAttribute('data-control-type')) {
                // There could be other items - placeholders
                // and clear-row elements
                continue
            }

            var values = getControlPropertyValues(listItem)
            if (values === null) {
                throw new Error('Property values are not found for a control list item.')
            }

            if (values['oc.fieldName'] === undefined) {
                throw new Error('Field name property is not found for a control.')
            }

            var fieldName = values['oc.fieldName']

            values.type = listItem.getAttribute('data-control-type')
            preProcessSpecialProperties(values)

            if (injectProperties !== undefined) {
                values = $.extend(values, injectProperties)
            }

            if (result[fieldName] !== undefined) {
                throw new Error('Duplicate field name: ' + fieldName)
            }

            // If a control contains control containers, parse them
            // and assign parsed object to the current control property.

            var childControls = parseControlControlContainer(listItem)
github ivandoric / Making-Websites-With-October-CMS / plugins / rainlab / builder / formwidgets / formbuilder / assets / js / formbuilder.domtopropertyjson.js View on Github external
DomToJson.getAllControlNames = function(rootContainer) {
        var controls = rootContainer.querySelectorAll('ul[data-control-list] > li.control'),
            result = []

        for (var i=controls.length-1; i>=0; i--) {
            var properties = getControlPropertyValues(controls[i])

            if (typeof properties !== 'object') {
                continue
            }

            if (properties['oc.fieldName'] === undefined) {
                continue
            }

            var name = properties['oc.fieldName']

            if (result.indexOf(name) === -1) {
                result.push(name)
            }
        }

        result.sort()

        return result
    }
github ivandoric / Making-Websites-With-October-CMS / plugins / rainlab / builder / formwidgets / formbuilder / assets / js / formbuilder.domtopropertyjson.js View on Github external
function preProcessSpecialProperties(properties) {
        delete properties['oc.fieldName']

        if (String(properties['oc.comment']).length > 0 && properties['oc.commentPosition'] == 'above') {
            properties['commentAbove'] = properties['oc.comment']

            if (properties['comment'] !== undefined) {
                delete properties['comment']
            }

            delete properties['oc.comment']
            delete properties['oc.commentPosition']
        }

        if (String(properties['oc.comment']).length > 0 && properties['oc.commentPosition'] == 'below') {
            properties['comment'] = properties['oc.comment']

            if (properties['comentAbove'] !== undefined) {
github ivandoric / Making-Websites-With-October-CMS / plugins / rainlab / builder / formwidgets / formbuilder / assets / js / formbuilder.domtopropertyjson.js View on Github external
DomToJson.getAllControlNames = function(rootContainer) {
        var controls = rootContainer.querySelectorAll('ul[data-control-list] > li.control'),
            result = []

        for (var i=controls.length-1; i>=0; i--) {
            var properties = getControlPropertyValues(controls[i])

            if (typeof properties !== 'object') {
                continue
            }

            if (properties['oc.fieldName'] === undefined) {
                continue
            }

            var name = properties['oc.fieldName']

            if (result.indexOf(name) === -1) {
                result.push(name)
            }
        }

        result.sort()

        return result
    }
github ivandoric / Making-Websites-With-October-CMS / plugins / rainlab / builder / formwidgets / formbuilder / assets / js / formbuilder.js View on Github external
FormBuilder.prototype.fieldNameExistsInContainer = function(container, fieldName) {
        var valueInputs = container.querySelectorAll('li.control[data-inspectable] input[data-inspector-values]')

        for (var i=valueInputs.length-1; i>=0; i--) {
            var value = String(valueInputs[i].value)

            if (value.length === 0) {
                continue
            }

            var properties = $.parseJSON(value)

            if (properties['oc.fieldName'] == fieldName) {
                return true
            }
        }

        return false
    }

oc

A framework for developing and distributing html components

MIT
Latest version published 2 months ago

Package Health Score

74 / 100
Full package analysis