I have a spring-boot, MVC, web application form. The user can type and object name in a field. This field got a bootstrap typeahead dynamique list of already existing objects.
I'd like to autofill my form's ohterfields with several object attribute when the user select a known object in the typeahead list.
My question is, in a correct implementation of MVC in springboot, how should this be done? How to tell my controller "Hey the user selected -foo- object, fill the other fields now!" ? Should it be a POST of the form? Is there a kind of @heyFillTheForm to put in the controller?
Thank you
From a design point of view, I'd indeed POST or PUT those parts of the form using an XHR.
However, I think would create two separate MVC controller methods:
retrieveAutofillValues
, returning a JSON-object with the prefill values. One might argue this should be a PUT
submitForm
, returning the result of the submit