It's even hard to explain. I have a form that checks a field if it is greater than zero. If so, I'll give the user a message. I want to turn this into a form error because, I can only release the save button if the form is error-free. I wonder if it's possible to do that. Here's my source (I could not format it in a way that I can get cute here):
<form #lancamentoForm="ngForm">
<div class="ui-g-12 ui-md-3 ui-fluid">
<label>Valor</label>
<input pInputText type="text" placeholder="0,00" currencyMask name="valor" #valor="ngModel"
[options]="{ prefix: '', thousands: '.', decimal: ',', allowNegative: false }" ngModel>
<div *ngIf="valor.value <= 0 && valor.dirty" class="ui-message ui-message-error">
Valor deve ser maior que 0
</div>
</div>
<button type="submit" pButton label="Salvar" [disabled]="lancamentoForm.invalid"></button>
</form>
I want to make sure that when the message 'Value greater than 0' is released, the FormatForm will be invalid for the button treatment. It's possible? Thanks!