[Advice] Form currently being processed
Hi!
Like there is a pending state when verification occurs, I would like to mark form as being processed after a request. I want to form to handle this not having to create a state into code.
I wasn't able to find any native solution to this in the lib. How do you advice to handle this now ? Should I create a specific field? can it be added in the future?
Thanks! Robert
Hi @Solido,
There is a PENDING state in Forms and Controls, when validity verifications are in progress, so not sure to understand your issue, can you give a more detailed example?
If you go and run the example folder project you will see in the "Complex Example" that we simulate a verification of an email in the server, and while the email is verified ni the server the state of the Form is PENDING.
Hi @joanpablo
Thank you for the quick reply. I read the source doc about about when prototyping but understood that it was true when and only when fields where being checkout by the backend.
In my scenario, after a check that a form is correct I build a request on a specific protocol to submit the form so I'm looking for a way to mark the form as executing the remote request.
I was not enable to modify pending since there is no field checkout, only form submit.
I ended adding my own new field 'remoteProcessing' as boolean. It works has intented but not that much clean.
So to clarify, I would like a way to manually set the pending value that does not represent a field validation but a form submission.
Pending and markAsTouched() does not reflect that they can solve the form processing only remove fields validation.
Also do we have some news from @vasilich6107 I saw he lives in Kyiv?
Any updates on this @joanpablo? I also stumbled upon this issue, I need to manually set the pending state for the form before making a request and set it back once done.
Hi @Kiura,
Thanks for bringing this ticket back to life. I will add the markAsPending() to AbstractControl in the next release. I'll let you know as soon as I release it.
Hi @joanpablo,
Thank you for being so prompt on tickets :) Great library, BTW!
Hi @Solido I was lucky enough to travel to Spain. So I'm currently in the safe place
Sorry for late response)
👋 Wish you favorable outcomes whatever you decide to do next!
On Mon 21 Aug 2023 at 17:50, Vasiliy Ditsyak @.***> wrote:
Hi @Solido https://github.com/Solido I was lucky enough to travel to Spain. So I'm currently in the safe place
— Reply to this email directly, view it on GitHub https://github.com/joanpablo/reactive_forms/issues/274#issuecomment-1686585297, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJ4MWNQXC5RLE7J3JOK3N3XWN7TBANCNFSM5PTVEUDA . You are receiving this because you were mentioned.Message ID: @.***>
-- Robbie
@Solido @Kiura
Version 16.1.0 has been released. Now you can mark controls as PENDING on demand.
Thanks for the support. 👍
A quick note. The only way to change the pending state (that you set manually with markAsPending()), is by calling setErrors() with an empty map, or maybe with some custom errors you get from the server, that is all up to you. But I'm open to any new suggestions.
setErrors() is good, however, markAsNotPending() would probably be clearer for those not aware of the setErrors() method with an empty map. Anyways, people searching for markAsNotPending() would end up in this ticket, which kinda solves the issue 😄
Prompt replies and swift new release... I am so happy I went with this library than the other more 'popular' one. Thx again for fixing this so quickly. You rock!