Permalink
Browse files

gallery-2011.06.08-20-04 jafl gallery-formmgr

  • Loading branch information...
1 parent de2c2cd commit 7098cb60f0eb191dbc582cdf457f962ce63dbc9f YUI Builder committed Jun 8, 2011
Showing with 17 additions and 3 deletions.
  1. +17 −3 src/gallery-formmgr/js/FormManager.js
@@ -91,6 +91,10 @@
* <p>More complex pre-validations can be added by overriding
* <code>postValidateForm()</code>, described below.</p>
*
+ * <p>Validation normally strips leading and trailing whitespace from every
+ * value. If you have a special case where this should not be done, add
+ * the CSS class <code>yiv-no-trim</code> to the input field.</p>
+ *
* <p>Derived classes may also override the following functions:</p>
*
* <dl>
@@ -353,11 +357,12 @@ function getId(
}
/**
- * Trim leading and trailing whitespace from the specified fields.
+ * Trim leading and trailing whitespace from the specified fields, except
+ * when a field has the CSS class yiv-no-trim.
*
* @method Y.FormManager.cleanValues
* @static
- * @param e {Array|NodeList} The fields to clean.
+ * @param e {Array} The fields to clean.
* @return {boolean} <code>true</code> if there are any file inputs.
*/
FormManager.cleanValues = function(
@@ -376,7 +381,7 @@ FormManager.cleanValues = function(
{
// don't change the value
}
- else if (input.value)
+ else if (input.value && !Y.DOM.hasClass(input, 'yiv-no-trim'))
{
input.value = Y.Lang.trim(input.value);
}
@@ -504,6 +509,15 @@ Y.extend(FormManager, Y.Plugin.Host,
},
/**
+ * @param node {String|Y.Node} the node in which status should be displayed
+ */
+ setStatusNode: function(
+ /* Node */ node)
+ {
+ this.status_node = Y.one(node);
+ },
+
+ /**
* Set the default values for all form elements.
*
* @param default_value_map {Object} Mapping of form element names to values.

0 comments on commit 7098cb6

Please sign in to comment.