Fragment rendering

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Fragment rendering

bigal.nz
Hello,

I am pretty new to Thymeleaf and I need to do a ajax call to request the details of a person.

I have the request sent to the controller and the data coming back to the client in format like:

surname : Smith
firstname : John
etc

On the html on the input I had something ilke:

Input name="surname" th:field=*{person[0].surname)

Note that I was expecting the JSON name and the field name to be the Same! So then I was going to use jquery to do :

var $theForm = $(this).closest('.panel-body');
$theForm.find('input[name="surname"]').val(result.surname);

The issue I have discovered is that thymeleaf renames the name field to the same as the th:field

How should I handle this situation?

Thanks

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Fragment rendering

xtian
Maybe you can use th:value instead of th:field?
Loading...