The Gallery is deprecated. No new Gallery components may be submitted, and modifying existing components is disabled. For more information please read the Gallery Deprecation blog post. This is a static snapshot of the Gallery for archive purposes.
YUI({
//Last Gallery Build of this module
gallery: 'gallery-2014.02.20-23-55'
}).use('gallery-formmgr', function(Y)
{
var f = new Y.FormManager('test_form',
{
status_node: '#form-status',
default_value_map: // overrides values in markup
{
s1: 'abc',
b1: 1,
b2: 0
}
});
f.prepareForm();
f.initFocus(); // only do this for one form on a page
// validations
f.setErrorMessages('email',
{
required: 'Please tell us how to spam you. (Just kidding!)',
regex: 'Please enter a valid email address.'
});
f.setRegex('email', /@.+\..+/); // not trying very hard
f.setErrorMessages('zip',
{
regex: 'Please enter a valid US ZIP Code.'
});
f.setRegex('zip', /^[0-9]{5}(?:-[0-9]{4})?$/);
f.setFunction('pw', function(form)
{
if (form.pw.value != form.pw2.value)
{
f.displayMessage(form.pw, 'Your password entries did not match.', 'error');
f.displayMessage(form.pw2, '', 'error');
return false;
}
return true;
});
f.postValidateForm = function(form)
{
var count = 0;
Y.each([form.b1, form.b2, form.b3], function(b)
{
if (b.checked) count++;
});
if (count < 2)
{
f.displayMessage(form.b1, 'Please select at least two checkboxes.', 'warn');
return false;
}
return true;
};
});
---------- start logs from yogi.stdout.log ---------- Manually removed due to "request entity too large" error ---------- end logs from yogi.stdout.log ---------- ---------- start logs from yogi.stderr.log ---------- Manually removed due to "request entity too large" error ---------- end logs from yogi.stderr.log ----------
All code on this site is licensed under the BSD License unless stated otherwise.