留言板
Disabled field does not pass on it's value.
Brian Jamieson,修改在12 年前。
Disabled field does not pass on it's value.
Junior Member 帖子: 51 加入日期: 10-10-15 最近的帖子
Hi,
I have a process that updates a visible, but disabled field programmatically. When the form is submitted, the new value is not persisted.
Has anyone else seen this behaviour ?
I think I'll change it to be something like demo.append('<div>You clicked ' + this.get('label')+'</div>'); but the behaviour is not what I expected.
I have a process that updates a visible, but disabled field programmatically. When the form is submitted, the new value is not persisted.
Has anyone else seen this behaviour ?
<aui:input name="entryRecoveryNote" id="entryRecoveryNote" size="45" value="<%= phoneBook.getEntryRecoveryNote() %>" disabled="true" style="color:red;" />
document.getElementById("<portlet:namespace />entryRecoveryNote").value = "Blah Blah Blah"
I think I'll change it to be something like demo.append('<div>You clicked ' + this.get('label')+'</div>'); but the behaviour is not what I expected.
Hitoshi Ozawa,修改在12 年前。
RE: Disabled field does not pass on it's value.
Liferay Legend 帖子: 7942 加入日期: 10-3-24 最近的帖子
I think you really want to make it a "readonly" field instead of "disabled. Unfortunately, I don't think aui supports "readonly".
Maybe, create an improvement request in the LPS?
Maybe, create an improvement request in the LPS?
Tejas Patel,修改在11 年前。
RE: Disabled field does not pass on it's value.
Junior Member 帖子: 71 加入日期: 12-1-24 最近的帖子Brian Jamieson:
Hi,
I have a process that updates a visible, but disabled field programmatically. When the form is submitted, the new value is not persisted.
Has anyone else seen this behaviour ?<aui:input name="entryRecoveryNote" id="entryRecoveryNote" size="45" value="<%= phoneBook.getEntryRecoveryNote() %>" disabled="true" style="color:red;" />
document.getElementById("<portlet:namespace />entryRecoveryNote").value = "Blah Blah Blah"
I think I'll change it to be something like demo.append('<div>You clicked ' + this.get('label')+'</div>'); but the behaviour is not what I expected.
You have to check that if the value you get is null or blank then do not change it.
ex
IN JSP page
<aui:input label="xyz" name="xyz" type="text" value="xyz" disabled="true" />
And in Controller (JAVA)
String str = ParamUtil.getString(actionRequest, "xyz", "");
if (!(str.equals("")))
{
//set new value here
}else{
//leave old value as is
}