Xpage 中的只读字段未提交 [英] ReadOnly field in Xpage not submitted

查看:33
本文介绍了Xpage 中的只读字段未提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 Xpage 中有一个字段,我希望它是只读的,并在保存时提交到数据库.此字段从 Ajax 调用中获取值

I have a field in my Xpage that I want to be readOnly and submitted to the database upon Save. This field gets a value from a Ajax call

将属性 ReadOnly 设置为 true 会创建一个 而不是只读字段.

Setting the property ReadOnly to true creates a <span> instead of a readonly field.

设置属性Show disabled control for readonly"会创建一个属性为 readonly=readonly 的输入文本字段.

Setting the property "Show disabled control for readonly" creates a input text field with the property readonly=readonly.

<input type="text" class="xspInputFieldEditBox" readonly="readonly" name="view:_id1:_id2:_id3:_id28:callbackFieldControlSet:InstrumentShort" id="view:_id1:_id2:_id3:_id28:callbackFieldControlSet:InstrumentShort">

它不会被保存到数据库中.

It will not be saved to the database.

据我所知,只读字段已提交但未禁用.

According to my knowledge readonly fields are submitted but not disabled.

我在这里做错了什么?

/M

推荐答案

您可以使用 attr-property 添加 readonly 属性:

You can add the readonly attribute with the attr-property:

<xp:inputText id="inputText2" value="#{document1.ReadOnly}">
   <xp:this.attrs>
      <xp:attr name="readonly" value="true" />
   </xp:this.attrs>
</xp:inputText>

顺便说一句:disabledreadonly 属性的行为是正确的,因为这是服务器端的定义.您想使用值编辑组件,这就是必须允许它接受值的原因.仅在客户端禁用它在技术上没有任何影响.

Btw: The behaviour of the disabled and the readonly property is correct, because this is a definition on the server side. You want to edit the component with a value, that is why it must be allowed to accept values. Just disabling it on the client side has technically no effect.

这篇关于Xpage 中的只读字段未提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆