Skip to content
Snippets Groups Projects

Issue #3493640 by bram.velthoven: Boolean field should not show "N/A" option when set to required

Open Issue #3493640 by bram.velthoven: Boolean field should not show "N/A" option when set to required
2 files
+ 60
4
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 11
0
@@ -120,6 +120,11 @@
@@ -120,6 +120,11 @@
.on('state:required', (e) => {
.on('state:required', (e) => {
if (e.trigger) {
if (e.trigger) {
const fieldsSupportingRequired = $(e.target).find('input, textarea');
const fieldsSupportingRequired = $(e.target).find('input, textarea');
 
 
// Option 'N/A' etc should not be present when field is required.
 
const requiredNoneOption = fieldsSupportingRequired
 
.filter('[id*="component-none"]')
 
.parent();
const legends = $(e.target).find('legend');
const legends = $(e.target).find('legend');
const legendsspan = $(e.target).find('legend span');
const legendsspan = $(e.target).find('legend span');
const labels = $(e.target).find(
const labels = $(e.target).find(
@@ -139,6 +144,9 @@
@@ -139,6 +144,9 @@
if (tabs.length !== 0) {
if (tabs.length !== 0) {
tab.find('strong').addClass('form-required');
tab.find('strong').addClass('form-required');
}
}
 
if (requiredNoneOption.length !== 0) {
 
requiredNoneOption.hide();
 
}
} else {
} else {
labels.addClass('form-required');
labels.addClass('form-required');
}
}
@@ -152,6 +160,9 @@
@@ -152,6 +160,9 @@
if (tabs.length !== 0) {
if (tabs.length !== 0) {
tab.find('strong').removeClass('form-required');
tab.find('strong').removeClass('form-required');
}
}
 
if (requiredNoneOption.length !== 0) {
 
requiredNoneOption.show();
 
}
} else {
} else {
labels.removeClass('form-required');
labels.removeClass('form-required');
}
}
Loading