Skip to content

Instantly share code, notes, and snippets.

@jmarnold
Created January 6, 2012 23:06
Show Gist options
  • Save jmarnold/1572865 to your computer and use it in GitHub Desktop.
Save jmarnold/1572865 to your computer and use it in GitHub Desktop.
correlation policy for dialogs
var correlationPolicy = {
matches: function (continuation) {
return continuation.correlationId != null && continuation.correlationId != '';
},
execute: function (continuation) {
if (continuation.errors && continuation.errors.length != 0) {
return;
}
var dialog = $('#' + continuation.correlationId).parents('.dialog');
if (dialog.size() != 0) {
dialog.dialog('close');
}
}
};
@rauhryan
Copy link

rauhryan commented Jan 6, 2012

automatically close dialogs?

I see... this doesn't go through amplify

watch out for ajaxed in forms with the same id what will bite you

@jmarnold
Copy link
Author

jmarnold commented Jan 6, 2012

Automatically close a dialog if the continuation is successful, yes. We're doing a quick check in the correlatedSubmit to make sure the form has an ID, but we could also verify that it's a unique form, as well. Our fubu conventions ensure that they're unique.

@rauhryan
Copy link

rauhryan commented Jan 6, 2012

@jmarnold
Copy link
Author

jmarnold commented Jan 6, 2012

We use the same form lookup to show the validation summary from fubuvalidation

@rauhryan
Copy link

rauhryan commented Jan 6, 2012

yep,

if validation got smarter you could highlight the actual input element that failed rather than
a summary at the top

@jmarnold
Copy link
Author

jmarnold commented Jan 6, 2012

Guess what we already do?

@rauhryan
Copy link

rauhryan commented Jan 6, 2012

should have know,

its good stuff it fits in really nicely with how blue works too

i'll have some feedback and contributions when finish supa picka

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment