how can i make a textfield read only in grails?

元气小坏坏 提交于 2019-12-01 20:08:48

问题


how can i make a textfield read only in grails.

I tried with readonly attribute on textfield as below but its not working.

<g:textField name="fname" size="14px"  id="fname" value="${patient.fname}" readonly="true">

回答1:


It does not allows readonly, try disabled="true"




回答2:


If you use disabled="true" the value will not actually be submitted in the form, so the <g:field/> tag should be used.

For example,

<g:field type="text" name="name" readonly="readonly" value="${instance.?name}"/>

More info here




回答3:


You can use readonly="readonly"



来源:https://stackoverflow.com/questions/6798558/how-can-i-make-a-textfield-read-only-in-grails

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!