imports/vx/client/code/ux.js
/**
     * Handle the results of the validation.  If an error occurs, display popover(s).
     * If no message was generated, and if dynamic mode, update the database directly.
     *
     * @param {object} component Component.
     * @param {array} validateArgs Validation arguments.
     * @param {object} result Result object from validation.
     */
Handle the results of the validation.  If an error occurs, display popover(s).
If no message was generated, and if dynamic mode, update the database directly.

@param {object} component Component.
@param {array} validateArgs Validation arguments.
@param {object} result Result object from validation.
Handle the results of the validation . If an error occurs display popover ( s ) . If no message was generated and if dynamic mode update the database directly . @param { object } component Component . @param { array } validateArgs Validation arguments . @param { object } result Result object from validation .
validateFinish(component, validateArgs, result) {
        if (result.success) {
            UX.deleteErrorFromComponent(component)
            UX.returnFormattedFields(component, validateArgs)
            if (UX.isFormDynamic(component)) {
                UX.updateDatabase(component)
            }
            if (UX.isFormRedux(component)) {
                UX.updateRedux(component)
            }
        }
        else {
            if (component.props.invalidHandler) {
                component.props.invalidHandler(component, validateArgs, result)
            }
            let localizedMessage = Util.i18n(result.key, result.variables)
            UX.addErrorToComponent(component, localizedMessage)
            if (component.props.extra) {
                _.each(component.props.extra, (extraId) => {
                    let extraComponent = UX.findComponentById(extraId)
                    UX.addErrorToComponent(extraComponent, localizedMessage)
                })
            }
        }
    }
validateFinish ( component , validateArgs , result ) { if ( result . success ) { UX . deleteErrorFromComponent ( component ) UX . returnFormattedFields ( component , validateArgs ) if ( UX . isFormDynamic ( component ) ) { UX . updateDatabase ( component ) } if ( UX . isFormRedux ( component ) ) { UX . updateRedux ( component ) } } else { if ( component . props . invalidHandler ) { component . props . invalidHandler ( component , validateArgs , result ) } let localizedMessage = Util . i18n ( result . key , result . variables ) UX . addErrorToComponent ( component , localizedMessage ) if ( component . props . extra ) { _ . each ( component . props . extra , ( extraId ) => { let extraComponent = UX . findComponentById ( extraId ) UX . addErrorToComponent ( extraComponent , localizedMessage ) } ) } } }
Handle the results of the validation.
Handle the results of the validation .
// If the validation rule says the data is valid, send back formatted data // into the component and potentially update the database: // Create errors and popovers for the primary field: // Set the error state for all other fields: