updated($propertyName) -> get property content in function

Hello there

I want to avoid the problem, when my users are entering something and delete it again, that there is an «foo is required» error under the input field.
in other words: i want to check the content of $propertyName in the updated function and only call validateOnly when its not empty. (Or any other way to achieve this.)

Thanks

Tobi

You could just remove the required rule from your validation, however, you would then allow an empty value for that field which I’m not sure is what you actually want. This begs the question, what do you intend to do if someone deletes a field and submits your form?

Alternatively in your updated methods you could check if the $newValue is empty and skip validation.

Surely either a field is required or it is not though?

Thanks Veleous

Yeah, its only a cosmetic thiny. When my customer first begin to enter some values into the form, the form is all nice and no errors are shown. But only after selecting a required field, the error pops up. That is just a bit ugly and maybe its a bit harsh too. All values are checked again, when submitting the completed form. I can not really remove this rule, the values are needed. I want to avoid this error only when they are entering.

How do i get the value $newValue? Did I overlook this in the docs?

[UPDATE after reading the docs again] Yeah its just there and i did see it…

Tobi

If you don’t want to show validation errors when users change field values, why not just disable realtime validation all together?

I want the realtime validation, but just not this error :slightly_smiling_face:

I think it’s just my brain :stuck_out_tongue:

(its working now btw )