...
BMP also provides a custom object for managing Form Data, BlinkForms
BlinkForms.currentFormObject
The Blink Forms object provides fast access to the currently loaded Blink Form. To examine the properties available, open up a form and then use console.log
...
Event | Trigger |
---|---|
formReady | Blink Form has been rendered, populated and inserted into page. |
formSubmitSuccess | Blink Form has successfully submitted. |
formSubmitErorr | Blink Form submission failed. |
subFormReady | Same as formReady, but for subforms. |
subFormRemoved | Blink Subform has been removed from the document. |
Code Examples
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
$(document).on('viewShow', function() { // this = the .view element
/* TODO: insert code to run after a view transition is completed */
});
$(document).on('viewReady', function() {
// this = the .view element
/* TODO: insert code to run after a view has been enhanced with Stars, Forms, Maps, etc */
});
$(document).on('formReady', function() {
// this = the form element
/* TODO: insert code to run after a form has been rendered, populated, and inserted into the page */
});
$(document).on('formSubmitSuccess', function(event) {
// this: not explicitly declared for this event
/* now you can make use of the following attributes:
* - event.Blink.interaction
* - event.Blink.form
* - event.Blink.action
* - event.Blink.uuid
* - event.Blink.id (not available if action === 'add')
* - event.Blink.jqxhr (see: http://api.jquery.com/jQuery.ajax/#jqXHR)
*/
/* TODO:insert code to run after a successful submission */
});
$(document).on('formSubmitError', function(event) {
// this: not explicitly declared for this event
/* see formSubmitSuccess example above */
/* TODO: insert code to run after a failed submission */
});
/**
* Hint: use $(document).one(...) if you only want your code to run exactly one time.
*/
$(document).on('subFormReady', function(event) {
// this = the subform element
// event.Blink.formElement = the BlinkFormElement for the linking field
// event.Blink.formObject = the BlinkFormObject for the sub record that was just added
// TODO: insert code to run after a sub-form has been added or populated
});
$(document).on('subFormRemoved', function(event) {
// this = the subform element
// event.Blink.formElement = the BlinkFormElement for the linking field
// TODO: insert code to run after a sub-form has been added or populated
}); |