Issue
I am using a dynamic field in my form, and would like to mask some of the values displayed and mask the value the user inserts. Is there a way of doing this in Thymeleaf? I tried:
<input type="password" name="password_config" th:field="*{MyList[__${firstArray.index}__][__${secondArray.index}__].value}" class="form-control" placeholder="Value" />
but the input box always appears blank when the page is loaded, even if the value in the object displayed is not null. The following line works for manipulating and displaying the value, but does not mask the value:
<input type="text" name="password_config" th:field="*{MyList[__${firstArray.index}__][__${secondArray.index}__].value}" class="form-control" placeholder="Value" />
Thanks in advance.
Solution
I managed to put text in <input type="password"
only this way:
<input type="password" name="pass" th:value="${subscription.pass}" />
Unfortunately if you check out the source of page you will see content of attribute value
in plain text. I think it's not possible to fill this input using th:field
.
Answered By - Iwo Kucharski