1

I am using some Dojo Filtering Select controls on my XPage. Despite having set the required property to false, when I attempt to save the XPage document, I see the message "This value is required" in the Dojo Filtering Select control. I would like to know

1/ is it possible to make a Dojo Filtering Select control NOT obligatory?

2/ Is it possible to customize the error message which appears when the control is obligatory?

4

2 回答 2

3

1)您在客户端验证时收到“此值是必需的”消息。因此,除了required="false"只负责服务器端验证的属性之外,您还必须将 dojoAttribute “required”设置为“false”。然后你就再也收不到消息了。

<xe:djFilteringSelect
    id="djFilteringSelect1"
    value="#{...}"
    required="false">
    <xe:this.dojoAttributes>
        <xp:dojoAttribute
            name="required"
            value="false">
        </xp:dojoAttribute>
    </xe:this.dojoAttributes>
</xe:djFilteringSelect>

2) 以同样的方式,您可以将 dojoAttribute "missingMessage" 设置为您喜欢的字符串,以防您的控制仍然是强制性的。

于 2013-10-04T14:38:12.290 回答
2

您可以自定义这些参数(它们在 FilteringSelect 的父 ValidationTextBox 中):

// required: Boolean
//      User is required to enter data into this field.
required: false,

// promptMessage: String
//      If defined, display this hint string immediately on focus to the textbox, if empty.
//      Also displays if the textbox value is Incomplete (not yet valid but will be with additional input).
//      Think of this like a tooltip that tells the user what to do, not an error message
//      that tells the user what they've done wrong.
//
//      Message disappears when user starts typing.
promptMessage: "",

// invalidMessage: String
//      The message to display if value is invalid.
//      The translated string value is read from the message file by default.
//      Set to "" to use the promptMessage instead.
invalidMessage: "$_unset_$",

// missingMessage: String
//      The message to display if value is empty and the field is required.
//      The translated string value is read from the message file by default.
//      Set to "" to use the invalidMessage instead.
missingMessage: "$_unset_$",

// message: String
//      Currently error/prompt message.
//      When using the default tooltip implementation, this will only be
//      displayed when the field is focused.
message: "",

如果将required设置为false,则不应提示消息,您可以发布代码。

于 2013-10-04T14:36:34.600 回答