Spring form input cannot be disabled

I want to disable <form:input> with the attribute disabled, but it does not work.

 <td class="value"> <sec:authorize access="hasAnyRole('ROLE_EDIT_DEVICE_INSTALL_DATE')"> <form:input path="installDt" maxlength="10" size="10" cssClass="installDatePicker" /> <form:errors path="installDt" cssClass="errormsg" /> </sec:authorize> <sec:authorize access="!hasAnyRole('ROLE_EDIT_DEVICE_INSTALL_DATE')"> <form:input path="installDt" maxlength="10" size="10" cssClass="installDatePicker" disabled="disabled" /> <form:errors path="installDt" cssClass="errormsg" /> </sec:authorize> </td> 

Does anyone have any ideas to solve this problem?

+6
source share
3 answers

I remove the cssClass date picker and set the boolean value to true and it works

0
source

To disable it, use disabled=true . It takes true | false

 <form:input path="installDt" maxlength="10" size="10" cssClass="installDatePicker" disabled="true" /> 
+16
source

When I try to disable input with the disabled value = "true", the data is zero in the base code, but when I try to execute it with readonly, I did it right.

Try readonly = "readonly"

+3
source

Source: https://habr.com/ru/post/984556/


All Articles