function FormState_111659() { formid = '111659'; this.getFragmentValue = getFragmentValue; this.setFragmentValue = setFragmentValue; this.validateAndReturnMessage = validateAndReturnMessage; this.clearFragmentErrors = clearFragmentErrors; this.getFragmentErrors = getFragmentErrors; this.validateInput = validateInput; this.checkConditions = checkConditions; // list of all fragments: this is for evaluating expressions var naam = new Object(); this['naam'] = new Object(); this['naam'].errors = new Object(); this['gx_action_naam'] = ''; var email = new Object(); this['email'] = new Object(); this['email'].errors = new Object(); this['gx_action_email'] = ''; var telefoonnummer = new Object(); this['telefoonnummer'] = new Object(); this['telefoonnummer'].errors = new Object(); this['gx_action_telefoonnummer'] = ''; var uw_vraag = new Object(); this['uw_vraag'] = new Object(); this['uw_vraag'].errors = new Object(); this['gx_action_uw_vraag'] = ''; var bijlage = new Object(); this['bijlage'] = new Object(); this['bijlage'].errors = new Object(); this['gx_action_bijlage'] = ''; this.required_validator = function(parameters, languageLabels) { if (this[parameters.fragment].value == undefined || this[parameters.fragment].value == "") { this[parameters.fragment].errors["MISSING"] = languageLabels["MISSING"]; } } this.email_validator = function(parameters, languageLabels) { var myExpression = /^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/; if (this[parameters.fragment].value != undefined && this[parameters.fragment].value != "" && !myExpression.test(this[parameters.fragment].value)) { this[parameters.fragment].errors["INVALID_EMAIL"] = languageLabels["INVALID_EMAIL"]; } } this.gx_validateInput_naam = function(inputName) { c = true; if (c) { var parameter = new Object(); if (inputName.indexOf('.') != -1) { splitted = inputName.split('.'); parameter.fragment = splitted[1]; } else { parameter.fragment = inputName; } var languageLabels = new Object(); languageLabels["MISSING"]='Dit veld is verplicht'; this['required_validator'](parameter, languageLabels); } } this.gx_validateInput_email = function(inputName) { c = true; if (c) { var parameter = new Object(); if (inputName.indexOf('.') != -1) { splitted = inputName.split('.'); parameter.fragment = splitted[1]; } else { parameter.fragment = inputName; } var languageLabels = new Object(); languageLabels["MISSING"]='Dit veld is verplicht'; this['required_validator'](parameter, languageLabels); var parameter = new Object(); if (inputName.indexOf('.') != -1) { splitted = inputName.split('.'); parameter.fragment = splitted[1]; } else { parameter.fragment = inputName; } var languageLabels = new Object(); languageLabels["INVALID_EMAIL"]='Vul a.u.b. een geldig e-mailadres in'; this['email_validator'](parameter, languageLabels); } } this.gx_validateInput_telefoonnummer = function(inputName) { c = true; if (c) { var parameter = new Object(); if (inputName.indexOf('.') != -1) { splitted = inputName.split('.'); parameter.fragment = splitted[1]; } else { parameter.fragment = inputName; } var languageLabels = new Object(); languageLabels["MISSING"]='Dit veld is verplicht'; this['required_validator'](parameter, languageLabels); } } this.gx_validateInput_uw_vraag = function(inputName) { c = true; if (c) { var parameter = new Object(); if (inputName.indexOf('.') != -1) { splitted = inputName.split('.'); parameter.fragment = splitted[1]; } else { parameter.fragment = inputName; } var languageLabels = new Object(); languageLabels["MISSING"]='Dit veld is verplicht'; this['required_validator'](parameter, languageLabels); } } Array.prototype.contains = function (element) { for (var i = 0; i < this.length; i++) { if (this[i] == element) { return true; } } return false; } function setPrecondition(identifier, inputidentifier, mode) { obj = document.getElementById('precondition_' + formid + '_' + inputidentifier); if (typeof obj != 'undefined') { value = obj.value; if (mode == 'add') { if (value == '') { obj.value = identifier } else { if (value != identifier && value.indexOf(',' + identifier) == -1) { obj.value = value + ',' + identifier } } } else { if (value == identifier) { obj.value = ''; } else { if (value.indexOf(identifier + ',') == 0) { obj.value = value.replace(identifier + ',','') } else { obj.value = value.replace(',' + identifier,'') } } } } } function getChange(identifier,b) { change = new Object(); change.identifier = identifier.replace('.','_'); if (b) { change.value = 'show'; setPrecondition(identifier,'show','add'); setPrecondition(identifier,'hide','remove'); } else { change.value = 'hide'; setPrecondition(identifier,'hide','add'); setPrecondition(identifier,'show','remove'); } return change; } function getFragmentValue(name) { if (name.indexOf('.') != -1) { splitted = name.split('.'); return this[splitted[0]][name].value; } else { return this[name].value; } } function setFragmentValue (name, value) { prefix = ''; if (name.indexOf('.') != -1) { splitted = name.split('.'); prefix = splitted[0]; } var valueObj = new Object(); if (typeof value != 'undefined' && value.constructor.toString().indexOf("Array") != -1) { // it's an array valueObj.value = value[0]; valueObj.values = value; } else { valueObj.value = value; } valueObj.errors = new Object(); if (prefix != '') { this[prefix][name] = valueObj; } else { this[name] = valueObj; } // update the local variable for the expressions try { if (value.length != null) { eval(name).values = value; } eval(name).value = value; } catch(e) {} return this.checkConditions(name); } function checkConditions(inputName) { if (inputName.indexOf('.') != -1) { splitted = inputName.split('.'); prefix = splitted[0]; if (typeof this[prefix]['gx_checkConditions_' + splitted[1]] != 'undefined') { return this[prefix]['gx_checkConditions_' + splitted[1]](); } else { return new Array(); } } else { if (typeof this['gx_checkConditions_' + inputName] != 'undefined') { return this['gx_checkConditions_' + inputName](); } else { return new Array(); } } } function validateInput(inputName) { if (inputName.indexOf('.') != -1) { splitted = inputName.split('.'); prefix = splitted[0]; if (typeof this[prefix]['gx_validateInput_' + splitted[1]] != 'undefined') { this[prefix]['gx_validateInput_' + splitted[1]](inputName); } } else { if (typeof this['gx_validateInput_' + inputName] != 'undefined') { this['gx_validateInput_' + inputName](inputName); } } } function clearFragmentErrors(inputName) { if (inputName.indexOf('.') != -1) { splitted = inputName.split('.'); prefix = splitted[0]; try { this[prefix][splitted[1]].errors = new Object(); } catch(e) {} } else { if (typeof this[inputName] != 'undefined') { this[inputName].errors = new Object(); } } } function getFragmentErrors(inputName) { if (inputName.indexOf('.') != -1) { splitted = inputName.split('.'); prefix = splitted[0]; try { return this[prefix][splitted[1]].errors; } catch(e) {} } else { return this[inputName].errors; } } function validateAndReturnMessage(inputName, inputValue) { this.clearFragmentErrors(inputName); this.setFragmentValue(inputName,inputValue); this.validateInput(inputName); return this.getFragmentErrors(inputName) } } if (typeof WebmanagerFormStateRegistry != 'undefined') { if (typeof WebmanagerFormStateRegistry['wmform_111659'] == 'undefined' || !WebmanagerFormStateRegistry['wmform_111659']) { WebmanagerFormStateRegistry['wmform_111659'] = new FormState_111659(); }; };