使用请求参数更改验证警报
Change validation alert with request parameter
我正在尝试通过连接请求值来更改验证约束警报,但此时我还没有找到密钥。
我遵循了这个例子:http://discuss.orbeon.com/Changing-section-s-label-dynamically-td4661767.html
我的控件是这样的:
<fr:c x="9" y="1" w="2" h="1">
<xf:input id="my-field-control"
bind="my-field-bind"
class="my-field">
<xf:label ref="$form-resources/my-field/label"/>
<xf:hint ref="$form-resources/my-field/hint"/>
<xf:alert ref="$form-resources/my-field/alert[1]"
validation="validation-82-validation"/>
<xf:alert ref="$form-resources/my-field/alert[2]"
validation="validation-61-validation"/>
<xf:alert ref="$form-resources/my-field/alert[3]"
validation="validation-79-validation"/>
<xf:alert ref="$form-resources/my-field/alert[4]"
validation="validation-80-validation"/>
<xf:alert ref="$form-resources/my-field/alert[5]"
validation="validation-81-validation"/>
<xf:alert ref="$form-resources/my-field/alert[6]"/>
<xf:action ev:event="xforms-ready">
<xf:setvalue ref="instance('fr-form-resources')/resources/resource[@xml:lang = 'es']/my-field/alert[1]"
value="concat(instance('fr-form-resources')/resources/resource[@xml:lang = 'es']/my-field/alert[1],xxf:get-request-parameter('my-request-parameter'))"/>
<xf:setvalue ref="instance('fr-form-resources')/resources/resource[@xml:lang = 'ca']/my-field/alert[1]"
value="concat(instance('fr-form-resources')/resources/resource[@xml:lang = 'ca']/my-field/alert[1],xxf:get-request-parameter('my-request-parameter'))"/>
</xf:action>
</xf:input>
</fr:c>
<xf:instance id=""fr-form-resources"" xxf:readonly=""false"" xxf:exclude-result-prefixes=""#all"">
<resources>
<resource xml:lang=""es"">
<my-field>
<label>my field</label>
<hint/>
<alert>Message</alert>
<alert>Message</alert>
<alert>Message</alert>
<alert>Message</alert>
<alert>Alert to change programatically</alert>
<alert/>
</my-field>
</resource>
<resource xml:lang=""ca"">
<my-field>
<label>my field</label>
<hint/>
<alert>Message</alert>
<alert>Message</alert>
<alert>Message</alert>
<alert>Message</alert>
<alert>Alert to change programatically</alert>
<alert/>
</my-field>
</resource>
</resources>
</xf:instance>
当我更改字段的值时,会启动约束并存在请求参数,因为用于检查我想更改其标签的约束,但验证消息始终是 'Alert to change programatically'
而不是 'Alert to change programatically + my-request-parameter value'
.
您对 xforms-ready
事件做出反应以使用资源更新实例的方法很有意义。但是,对于 运行,您的处理程序需要在 <xf:model>
内,因为 xforms-ready
是一个发送给模型的事件。
要对此进行调试,您还可以在操作中插入 <xf:message value="…">
,以检查代码 运行s,并检查某些表达式是否确实 return 您期望的值。
我正在尝试通过连接请求值来更改验证约束警报,但此时我还没有找到密钥。
我遵循了这个例子:http://discuss.orbeon.com/Changing-section-s-label-dynamically-td4661767.html
我的控件是这样的:
<fr:c x="9" y="1" w="2" h="1">
<xf:input id="my-field-control"
bind="my-field-bind"
class="my-field">
<xf:label ref="$form-resources/my-field/label"/>
<xf:hint ref="$form-resources/my-field/hint"/>
<xf:alert ref="$form-resources/my-field/alert[1]"
validation="validation-82-validation"/>
<xf:alert ref="$form-resources/my-field/alert[2]"
validation="validation-61-validation"/>
<xf:alert ref="$form-resources/my-field/alert[3]"
validation="validation-79-validation"/>
<xf:alert ref="$form-resources/my-field/alert[4]"
validation="validation-80-validation"/>
<xf:alert ref="$form-resources/my-field/alert[5]"
validation="validation-81-validation"/>
<xf:alert ref="$form-resources/my-field/alert[6]"/>
<xf:action ev:event="xforms-ready">
<xf:setvalue ref="instance('fr-form-resources')/resources/resource[@xml:lang = 'es']/my-field/alert[1]"
value="concat(instance('fr-form-resources')/resources/resource[@xml:lang = 'es']/my-field/alert[1],xxf:get-request-parameter('my-request-parameter'))"/>
<xf:setvalue ref="instance('fr-form-resources')/resources/resource[@xml:lang = 'ca']/my-field/alert[1]"
value="concat(instance('fr-form-resources')/resources/resource[@xml:lang = 'ca']/my-field/alert[1],xxf:get-request-parameter('my-request-parameter'))"/>
</xf:action>
</xf:input>
</fr:c>
<xf:instance id=""fr-form-resources"" xxf:readonly=""false"" xxf:exclude-result-prefixes=""#all"">
<resources>
<resource xml:lang=""es"">
<my-field>
<label>my field</label>
<hint/>
<alert>Message</alert>
<alert>Message</alert>
<alert>Message</alert>
<alert>Message</alert>
<alert>Alert to change programatically</alert>
<alert/>
</my-field>
</resource>
<resource xml:lang=""ca"">
<my-field>
<label>my field</label>
<hint/>
<alert>Message</alert>
<alert>Message</alert>
<alert>Message</alert>
<alert>Message</alert>
<alert>Alert to change programatically</alert>
<alert/>
</my-field>
</resource>
</resources>
</xf:instance>
当我更改字段的值时,会启动约束并存在请求参数,因为用于检查我想更改其标签的约束,但验证消息始终是 'Alert to change programatically'
而不是 'Alert to change programatically + my-request-parameter value'
.
您对 xforms-ready
事件做出反应以使用资源更新实例的方法很有意义。但是,对于 运行,您的处理程序需要在 <xf:model>
内,因为 xforms-ready
是一个发送给模型的事件。
要对此进行调试,您还可以在操作中插入 <xf:message value="…">
,以检查代码 运行s,并检查某些表达式是否确实 return 您期望的值。