eLabSDK.Wizard.Report
Classes
| Name | Description |
|---|---|
| initialize |
Functions
| Name | Description |
|---|---|
| reportSuccess(message) | Display a success message in the wizard panel. |
This shows a success notification within the current wizard panel, typically used to confirm
successful operations, validate user input, or provide positive feedback. The message appears
with success styling (typically green) and includes a close button. Any existing success
message is replaced. Use this to provide immediate feedback after successful operations like
data validation, API calls, or form submissions within wizard steps.
reportError(warning) | Display an error message in the wizard panel.
This shows an error notification within the current wizard panel, typically used to indicate
validation failures, API errors, or invalid user input. The message appears with error
styling (typically red) and includes a close button. Any existing error message is replaced.
Use this to provide immediate feedback about problems that need to be resolved before
proceeding in the wizard.
initialize
Kind: global class
new initialize(config)
| Param | Type |
|---|---|
| config | object |
reportSuccess(message)
Display a success message in the wizard panel.
This shows a success notification within the current wizard panel, typically used to confirm
successful operations, validate user input, or provide positive feedback. The message appears
with success styling (typically green) and includes a close button. Any existing success
message is replaced. Use this to provide immediate feedback after successful operations like
data validation, API calls, or form submissions within wizard steps.
Kind: global function
| Param | Type | Description |
|---|---|---|
| message | string | The success message text to display (can include HTML) |
Example
// Show success after data validation
var wizard = new eLabSDK.Wizard({
title: 'Sample Creation',
nextButton: {
label: 'Next',
fn: function(panel) {
var report = new eLabSDK.Wizard.Report({
prefix: wizard.options.prefix || 'custom',
index: panel.index
});
var sampleName = $('#sampleName').val();
if (sampleName && sampleName.length > 3) {
report.reportSuccess('✓ Sample name is valid');
setTimeout(function() {
wizard.nextPanel(getNextPanel());
}, 1000);
} else {
report.reportError('Sample name must be at least 3 characters');
}
}
}
});
Example
// Show success after API call
var report = new eLabSDK.Wizard.Report({
prefix: 'custom',
index: currentPanel.index
});
$.post('/api/v1/validate', formData, function(response) {
if (response.valid) {
report.reportSuccess('Data validated successfully');
}
});
Example
// Success with HTML formatting
var report = new eLabSDK.Wizard.Report({
prefix: 'wizard',
index: panel.index
});
report.reportSuccess(
'<strong>Success!</strong> ' +
'Created ' + sampleCount + ' samples. ' +
'<a href="/samples">View samples</a>'
);
reportError(warning)
Display an error message in the wizard panel.
This shows an error notification within the current wizard panel, typically used to indicate
validation failures, API errors, or invalid user input. The message appears with error
styling (typically red) and includes a close button. Any existing error message is replaced.
Use this to provide immediate feedback about problems that need to be resolved before
proceeding in the wizard.
Kind: global function
| Param | Type | Description |
|---|---|---|
| warning | string | The error message text to display (can include HTML) |
Example
// Show error for validation failure
var wizard = new eLabSDK.Wizard({
title: 'Sample Creation',
nextButton: {
label: 'Next',
fn: function(panel) {
var report = new eLabSDK.Wizard.Report({
prefix: wizard.options.prefix || 'custom',
index: panel.index
});
var quantity = parseFloat($('#quantity').val());
if (isNaN(quantity) || quantity <= 0) {
report.reportError('✗ Please enter a valid quantity greater than 0');
return; // Don't proceed
}
report.reportSuccess('Quantity is valid');
wizard.nextPanel(getNextPanel());
}
}
});
Example
// Show error after failed API call
var report = new eLabSDK.Wizard.Report({
prefix: 'custom',
index: currentPanel.index
});
$.post('/api/v1/samples', sampleData)
.done(function(response) {
report.reportSuccess('Sample created successfully');
})
.fail(function(xhr) {
report.reportError('Failed to create sample: ' + xhr.responseText);
});
Example
// Multiple validation errors
var report = new eLabSDK.Wizard.Report({
prefix: 'wizard',
index: panel.index
});
var errors = [];
if (!$('#name').val()) errors.push('Name is required');
if (!$('#email').val()) errors.push('Email is required');
if (!$('#quantity').val()) errors.push('Quantity is required');
if (errors.length > 0) {
report.reportError(
'<strong>Please fix the following errors:</strong><ul>' +
errors.map(function(e) { return '<li>' + e + '</li>'; }).join('') +
'</ul>'
);
}
Example
// Clear previous error with success
var report = new eLabSDK.Wizard.Report({
prefix: 'wizard',
index: panel.index
});
// Show error initially
report.reportError('Checking availability...');
// After validation
setTimeout(function() {
if (isAvailable) {
report.reportSuccess('Name is available');
} else {
report.reportError('Name is already taken');
}
}, 1000);
© 2023 eLabNext
Updated about 18 hours ago