Django forms to return fields errors without page reload

Hi everyone.
I have complicated legacy code which can’t be easily posted here. Therefore will understand if I will not find a direct solution but at least a right direction where to look for.
Problem:
I have a view renders template with a formset_1 which consist of some info data and just one field (ChoiceField). Once that field chosen AJAX request performs to another view and depends on data passed the another set of formset_2 renders with pre-populated data utilizing render_to_string() passing context data. And then only another view utilized on submit to receive formset for validation.
Question:
Is there a way to render field related error messages on formset_2 if form set is not valid?

Is this submission of the formset_2 being done as another AJAX request, or is this a page-level submission being done?

If it’s a page-level submission, then there will be a full-page reload - you’ve gone past the point where you have any control over what’s happening in the browser. In this situation, about the best you can do is ensure that everything you need to recreate the current “page as it’s being displayed” is submitted as part of the request, and then render that complete page with errors as the response to the post submission.

If you’re doing an AJAX request, then it would be up to you to have your view rerender that formset with the errors, and use that response to repopulate that portion of the page. (The exact specific of this would depend upon the details of the page and the processing that needs to occur.)

No, it’s not. This submission being done with default HTML form action attribute.

If I understand you right using AJAX post request instead of HTML standard form submission will allow me to refresh page content (including field error highlights) without refreshing complete page?

That is correct, and is the key difference between the two.

A standard HTML form submission will result in a full page reload.

An AJAX request (of any type) does not result in a full page reload. This puts the work on you (using JavaScript directly or a library such as jQuery or HTMX) to figure out what to do with the response received from the server.

Good day, Ken. Thank you for guidance in that direction. That seems to work as described. Some things have to be adjusted but nothing critical.