thymeleaf: th:value is ignored when using th:field

后端 未结 3 992
一个人的身影
一个人的身影 2021-02-04 11:52

I\'ve got a form where I want to edit some user data. So the already stored data is put as th:value and after sending I validate with spring validation and want to give back the

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-04 12:26

    Attribute th:field will replace attributes value, id and name in your input tag.

    Instead, use plain th:id, th:value and th:name without using th:field. Then you will get what you wanted.

    Then it will look like:

    
    

    Similar answer is here: How to set thymeleaf th:field value from other variable

提交回复
热议问题