When user clicks at one of the toolbar items submit button gets enabled (for example bold toolbar item). I want to prevent this behavior. How to enable submit button only in case when user types text in input field?
Best regards,
Kristina
<div class="control-section">
<div class="content-wrapper">
<div
id="content"
class="box-form"
style="margin: 0 auto; max-width:750px; padding:25px"
>
<form (ngSubmit)="onSubmit()" #rteForm="ngForm">
<div class="form-group">
<ejs-richtexteditor
#fromRTE
#name="ngModel"
[(value)]="value"
required
name="name"
[(ngModel)]="value"
(created)="rteCreated()"
[saveInterval]="1"
(change)="onChange(fromRTE)"
></ejs-richtexteditor>
<div *ngIf="name.invalid && name.touched" class="alert alert-danger">
<div *ngIf="name.errors.required">Value is required.</div>
</div>
</div>
<div>
<button type="submit" ejs-button [disabled]="disableBtn">
Submit
</button>
<button type="reset" ejs-button style="margin-left: 20px">
Reset
</button>
</div>
</form>
</div>
</div>
</div> |
onChange(args) {
if (args.getText().trim().replace(/\u200B/g, '').length > 0) {
this.disableBtn = false;
} else {
this.disableBtn = true;
}
}
|
Hi Indrajith,
This solution resolved problem. Thank you!
Hi Kristina,
Welcome,
Please get back to us if you need any further assistance.
Regards,
Indrajith