MDL-49783 forms: Collapsed form section is opened on error

This commit is contained in:
Martin Mastny
2015-05-07 08:57:30 +08:00
parent 24a2babdd3
commit eaec9cfec7
10 changed files with 128 additions and 11 deletions
+19 -1
View File
@@ -42,6 +42,17 @@ M.core.event = {
FILTER_CONTENT_UPDATED: "filter-content-updated"
};
M.core.globalEvents = {
/**
* This event is triggered when form has an error
*
* @event "form_error"
* @param formid {string} Id of form with error.
* @param elementid {string} Id of element with error.
*/
FORM_ERROR: "form_error"
};
var eventDefaultConfig = {
emitFacade: true,
@@ -56,6 +67,8 @@ var eventDefaultConfig = {
}
};
// Publish events with a custom config here.
// Publish all the events with a standard config.
var key;
for (key in M.core.event) {
@@ -64,4 +77,9 @@ for (key in M.core.event) {
}
}
// Publish events with a custom config here.
//Publish all the global events.
for (key in M.core.globalEvents) {
if (M.core.globalEvents.hasOwnProperty(key)) {
Y.Global.publish(M.core.globalEvents[key], Y.merge(eventDefaultConfig, {broadcast: 2}));
}
}