Index: openacs-4/packages/xowiki/www/resources/yui-form-field-validate.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/yui-form-field-validate.js,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/www/resources/yui-form-field-validate.js 24 Nov 2009 14:11:40 -0000 1.1 @@ -0,0 +1,103 @@ +/* + * A simple form field validator based on YUI + * + * Gustaf Neumann fecit Nov 2009 + */ + +YAHOO.namespace('xo_form_field_validate'); + +YAHOO.xo_form_field_validate = { + current_url: "", + currentID: "", + ids: new Array(), + + init: function() { + // console.log("init"); + var ids = YAHOO.xo_form_field_validate.ids; + for (var i=0; i 10) { + // there must have happened a redirect + console.info(o); + alert("Refresh your login and redo update"); + //window.location.href = this.package_url + // + "?refresh-login&return_url=" + // + escape(this.current_url); + } else { + var inputID = this.currentID; + var errorEl = YAHOO.util.Dom.get(inputID + "-error"); + var inputEl = YAHOO.util.Dom.get(inputID); + if (errorEl != undefined) { + errorEl.parentNode.removeChild(errorEl); + } + } + }, + + scope: YAHOO.xo_form_field_validate + } + + var url = window.location.href.replace(/[?].*/,"") + '?m=validate-attribute'; + var post_query = e.target.name + '=' + escape(e.target.value); + YAHOO.xo_form_field_validate.current_url = url + '&' + post_query; + YAHOO.xo_form_field_validate.currentID = e.target.id; + //console.log(url); + //console.log(post_query); + YAHOO.util.Connect.asyncRequest('POST', url, this.callback, post_query); + return 1; + } + +}; + +YAHOO.util.Event.onDOMReady(YAHOO.xo_form_field_validate.init); +