/* /** * CHRONOFORMS version 3.0 * Copyright (c) 2008 Chrono_Man, ChronoEngine.com. All rights reserved. * Author: Chrono_Man (ChronoEngine.com) You are not allowed to copy or use or rebrand or sell any code at this page under your own name or any other identity! Unlike the Chronoforms extension license, This file is NOT released under the GNU/GPL license and it can be distributed with the Chronoforms package distributed by ChronoEngine.com ONLY according to a written permission from "this" file's owner, if you want to include this file in any packages then you MUST get a written permission from the owner, contact webmaster@chronoengine.com for more details! * See readme.html. * Visit http://www.ChronoEngine.com for regular update and information. **/ function elementExtend() { Element.extend({ getInputByName : function(name) { el = this.getFormElements().filterByAttribute('name', '=', name) return (el)?(el.length)?el[0]:el:false; }, getInputsByName : function(nome) { el = this.getFormElements().filterByAttribute('name','=',nome) return (el)?el:false; }, getProperty: function(property){ var index = Element.Properties[property]; if (index) return this[index]; var flag = Element.PropertiesIFlag[property] || 0; // Commented old line // if (!window.ie || flag) return this.getAttribute(property, flag); // Two new lines: put MSIE version number in var msie and check if this is 8 or higher var msie = navigator.userAgent.toLowerCase().match(/msie\s+(\d)/); if (!window.ie || flag || msie && msie[1]>=8) return this.getAttribute(property, flag); var node = this.attributes[property]; return (node) ? node.nodeValue : null; } }); } function setValidation(chronoformname, valonBlur, valonSubmit, valwait_time) { Validate.One_Required = function(elm, paramsObj){ var paramsObj = paramsObj || {}; var message = paramsObj.failureMessage || "Must Choose one"; var ready = false; var elm = paramsObj.elm; var p = elm.parentNode; var myoptions = $(chronoformname).getInputsByName(elm.getProperty('name')); for(i=0; i 1 ) { field.options[0].selected = true; } name.add( Validate.Presence, { failureMessage: message_validate_selection }); fieldsarray[fieldsarray_count] = name; fieldsarray_count = fieldsarray_count + 1; } }); $ES('textarea', $(chronoformname)).each(function(field){ var name = ''; var tmessage = ''; var name = "cfvalidate_"+field.getProperty('name').replace('[]', ''); name = new LiveValidation(field, { validMessage: ' ', onlyOnBlur: valonBlur, onlyOnSubmit:valonSubmit, wait:valwait_time }); if(field.getProperty('title')){ tmessage = field.getProperty('title'); } if(field.hasClass('required')){ if( tmessage ) { var message_required = tmessage; } //if( field.size > 1 ) { field.options[0].selected = true; } name.add( Validate.Presence, { failureMessage: message_required }); fieldsarray[fieldsarray_count] = name; fieldsarray_count = fieldsarray_count + 1; } }); }