<fieldset class="opt-out-prompt">
<span *ngIf="editMode==='del'>
<p>months you don't need this order?</p>
<input type="radio" formControlName="actionType" name="actionType" role="radiogroup" id="deleteorder">
<label for="deleteorder"> No, please delete my order altogether</label>
<br>
<input type="radio" formControlName="actionType" name="actionType" role="radiogroup" id="optoutmonth" >
<label for="optoutmonth"> Yes, show me opt-out months</label>
</span>
<div *ngIf="submittedOnce && cartForm.errors?.required">
<p>Please select either value</p>
</div>
</fieldset>
.TS Code :
CartOptionForm = this.fb.group({
actionType: ['', [Validators.required]]
})
get cartForm() {
return this.CartOptionForm.get('actionType');
}
onSubmit() {
this.submittedOnce = true;
if (this.isFormValid()) {
// success
}
}
isFormValid(): boolean {
if(!this.CartOptionForm.valid) {
return false;
}
else
{
return true
}
}