sam-checkbox (multi) is not showing the required error message.
Los mantenedores suelen responder en 3 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 42/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- angular, typescript
- Área
- frontend
Línea de trabajo
Comienza por la ruta de validación de required del componente sam-checkbox y compárala con el comportamiento de sam-text y sam-radio descrito en el issue. Reproduce la navegación con una selección múltiple de casillas vacía y verifica después que aparece el error de required sin marcar y desmarcar primero una casilla.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
sam-checkbox (multi) is not showing the required error message when we are going to next page.
if I add the same backend config for sam-text or sam-radio, they are showing the required error message.
if we click on the checkbox and uncheck the checkbox, then only it is showing the error message.
<div class="sam-ui segment" [hidden]="!checkFieldDisplayOption('FAR_CASES')" *ngIf="shouldShowFarCases()">
<sam-checkbox
[attr.id]="farCasesConfig.id"
[(model)]="farCasesTypesModel"
[name]="farCasesConfig.name"
[options]="farCasesConfig.options"
[label]="farCasesConfig.label"
[hint]="farCasesConfig.hint"
[control]="generalInfoForm.controls['farCasesTypes']"
[formControl]="generalInfoForm.controls['farCasesTypes']"
[required]="true">
</sam-checkbox>
</div>
farCasesTypesModel = [];
public readonly farCasesConfig = {
id: OpportunityFieldNames.FAR_CASES,
label: 'Requirements Strategy',
name: OpportunityFieldNames.FAR_CASES + '-checkbox',
required: false,
hasSelectAll: false,
hint: 'Select at least one checkbox in this section',
errorMessage: undefined,
options: [
{value: 'FAR 7.107-2', label: 'FAR.&.7.107-2 - Intent to consolidate requirements Determination that consolidation is necessary and justified with the publication of the solicitation in Description.', name: 'checkbox-far-7.107.2'},
{value: 'FAR 7.107-3', label: 'FAR.&.7.107-3 - Intent to bundle requirements Determination that bundling is necessary and justified with the publication of the solicitation in Description.', name: 'checkbox-far-7.107.3'},
{value: 'FAR 7.107-4', label: 'FAR.&.7.107-4 - Intent to substantially bundle requirements Include the rationale for substantial bundling as part of the determination for bundling with the publication of the solicitation', name: 'checkbox-far-7.107.4'},
]
};
constructor(private errorService: OpportunityFormErrorService,
private cdr: ChangeDetectorRef,
private formBuilder: FormBuilder,
private oppFormService: OpportunityFormService,
private noticeTypeMapService: OppNoticeTypeMapService,
private timezoneService: OpportunityTimezoneService,
private oppAutoFillService: OppRelatedNoticeAutoFillService,
private dictionaryService: DictionaryService) {
Object.freeze(this.archiveDateConfig);
Object.freeze(this.vendorsCDIvlConfig);
Object.freeze(this.vendorsVIvlConfig);
Object.freeze(this.authorityConfig);
Object.freeze(this.addiReportingConfig);
Object.freeze(this.farCasesConfig);
}
ngOnInit() {
this.loadFarCases();
}
createForm() {
this.generalInfoForm = this.formBuilder.group({
farCasesTypes: null
});
this.cdr.detectChanges();
if (this.viewModel.getSectionStatus(OpportunitySectionNames.GENERAL) === 'updated') {
this.generalInfoForm.get('farCasesTypes').markAsDirty({onlySelf: true});
this.generalInfoForm.get('farCasesTypes').updateValueAndValidity();
}
}
loadFarCases() {
console.log('loading far cases ' + this.oppGeneralInfoViewModel.farCasesTypes + ',' + this.farCasesTypesModel);
if ( this.oppGeneralInfoViewModel.farCasesTypes ) {
this.farCasesTypesModel = this.oppGeneralInfoViewModel.farCasesTypes;
}
}
updateForm() {
this.generalInfoForm.patchValue({
farCasesTypes: this.farCasesTypesModel
}, {
emitEvent: false
});
console.log('patching ' + this.farCasesTypesModel + ',' + this.addiReportingTypes);
this.cdr.detectChanges();
this.updateErrors();
}
subscribeToChanges() {
this.linkControlTo(this.generalInfoForm.get('farCasesTypes'), this.saveFarCasesTypes);
}
private saveFarCasesTypes(farCases) {
console.log('saving farcases ' + farCases);
this.oppGeneralInfoViewModel.farCasesTypes = farCases;
this.cdr.detectChanges();
this.updateFarCasesError();
}
public updateErrors() {
console.log('updating errors ' + this.farCasesTypesModel + ',' + this.addiReportingTypes);
this.updateFarCasesError();
this.cdr.detectChanges();
}
private updateFarCasesError() {
console.log('updating far cases error ' + this.errorService.validateFarCases().errors?.id);
this.generalInfoForm.get('farCasesTypes').clearValidators();
this.generalInfoForm.get('farCasesTypes').setValidators((control) => {
return control.errors
});
this.generalInfoForm.get('farCasesTypes').setErrors(this.errorService.validateFarCases().errors);
this.markAndUpdateFieldStat('farCasesTypes');
this.emitErrorEvent();
}
shouldShowFarCases() {
return ( environment.SHOW_REQUIREMENTS_STRATEGY === 'true' && this.viewModel.oppHeaderInfoViewModel.opportunityType === 'i' );
}
error-service
public validateFarCases(): OppFieldError {
let fieldErrors = {
id: OpportunityFieldNames.FAR_CASES,
errors: null,
};
if (this._viewModel.data.type && this._viewModel.data.type === 'i') {
if (!this._viewModel.oppGeneralInfoViewModel.farCasesTypes || !this._viewModel.oppGeneralInfoViewModel.farCasesTypes.length) {
fieldErrors.errors = this.validateRequired('Requirements Strategy', this._viewModel.oppGeneralInfoViewModel.farCasesTypes);
}
}
let sectionErrors = OpportunityFormErrorService.findErrorById(this._errors, OpportunitySectionNames.GENERAL) as OppFieldErrorList;
this.setOrUpdateError(sectionErrors, fieldErrors);
console.log('fieldErrors ' + fieldErrors.id + ',' + fieldErrors?.errors?.requiredField?.message);
return fieldErrors;
}
- Lenguaje dominante
- TypeScript
- Estrellas
- 8
- Forks
- 33
- Merge medio
- 3 d 21 h
- PR fusionados (30 d)
- 9
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de GSA/sam-ui-elements
-
github_actions security
Dificultad 2/5 Medio día Aptitud para principiantes 88/100
GSA/sam-ui-elements#761 ·
Los mantenedores suelen responder en 3 días
-
tech-debt
Dificultad 4/5 3-5 días Aptitud para principiantes 56/100
GSA/sam-ui-elements#708 ·
Los mantenedores suelen responder en 3 días
-
disablePageTabIndex() sets aria-hidden on the focused calendar button, and enablePageTabIndex() never removes itQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abiertobugfix
Dificultad 4/5 3-5 días Aptitud para principiantes 68/100
GSA/sam-ui-elements#682 ·
Los mantenedores suelen responder en 3 días
-
bugfix
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
GSA/sam-ui-elements#681 ·
Los mantenedores suelen responder en 3 días
-
Burn down ESLint and Angular lint debtQuizá libre de nuevo @fpigeonjr la tomó hace 57 días y no hay ningún pull request abierto. Abiertoangular-upgrade maintenance
GSA/sam-ui-elements#580 · 1 asignado ·
Los mantenedores suelen responder en 3 días
Todos los issues de GSA/sam-ui-elements
Issues similares
-
bug skills
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
equinor/fusion-framework#5846 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 74/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Eyevinn/open-videocore#1256 ·
Los mantenedores suelen responder en 1 día
-
Frontend build fails with Frappe version-16: DataImport is no longer exported by @framework/uiAbiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
[Bug]: Theme preset geist points at undefined --font-geistPosiblemente ocupada @claude la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
Los mantenedores suelen responder en 1 día