I have a custom dialog where I need to validate the contents and have the dialog close if everything is valid and stay open with validation if everything is not. It does not appear that there is a way to do this, and the documentation is extremely vague on about everything beyond the cherry-picked examples included in the base project. Am I missing something?
this.selectorService.openDialog({
commands: [{
name: "save",
category: BUTTON_PRIMARY_CATEGORY,
title: "Save",
ordinal: 0,
token: {
type: OccurrenceDialogSaveCommand,
properties: {
component: this,
model: dialogItem,
outputData: formOutput
}
}
}, {
name: "cancel",
category: BUTTON_CANCEL_CATEGORY,
title: "Cancel",
ordinal: 1
}],
componentData: {
type: OccurrenceFormComponent,
properties: {
occurrence: dialogItem,
outputData: formOutput
}
}
}).subscribe(x => {
console.log(x);
console.log(dialogItem);
});
@Injectable()
export class OccurrenceDialogSaveCommand implements Command {
execute(context: ExecutionContext): Observable<any> {
var s = new Subject();
console.log(context);
s.next(true);
return s;
}
}
<div class="occurrence-form">
<h1>Occurrence Form</h1>
<form class="sf-form -condensed" #myForm>
<sf-field-wrapper [isRequired]="true" [showErrors]="true">
<sf-input label="Date" type="date" [(ngModel)]="occurrence.InstanceDate"
inputmode="date" name="date" required #date="ngModel"></sf-input>
<div *ngIf="date.errors?.required" class="sf-input__required">
Date is required!
</div>
</sf-field-wrapper>
<div class="sf-row">
<div class="sf-row__col">
<sf-field-wrapper [isRequired]="true" [showErrors]="true">
<sf-input label="Start Time" type="time" [(ngModel)]="occurrence.StartTime"
name="startTime" #startTime="ngModel" required></sf-input>
</sf-field-wrapper>
<div *ngIf="startTime.errors?.required" class="sf-input__required">
Start time is required!
</div>
</div>
<div class="sf-row__col">
<sf-field-wrapper [isRequired]="true" [showErrors]="true">
<sf-input label="End Time" type="time" [(ngModel)]="occurrence.EndTime"
name="endTime" #endTime="ngModel" required></sf-input>
</sf-field-wrapper>
<div *ngIf="endTime.errors?.required" class="sf-input__required">
End time is required!
</div>
</div>
</div>
</form>
</div>
I have a custom dialog where I need to validate the contents and have the dialog close if everything is valid and stay open with validation if everything is not. It does not appear that there is a way to do this, and the documentation is extremely vague on about everything beyond the cherry-picked examples included in the base project. Am I missing something?