为什么required ="true"?当disabled为"true"时,验证不会失败.被指定 [英] Why does required="true" not fail validation when disabled="true" is specified

查看:331
本文介绍了为什么required ="true"?当disabled为"true"时,验证不会失败.被指定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<a4j:outputPanel id="tapalSectionSendToPanel" ajaxsingle="true">
    <h:inputText id="sendToId1"  value="#{MainBean.SectionBean.sendTo}" 
        class="createresizedTextbox" 
        required="true" requiredMessage="#{msg.labl_required}"
        disabled="true" />
 <h:message for="sendToId1" style="color:red" />
</a4j:outputPanel> 

我需要验证文本框以进行空验证,并且当我单击按钮而不在文本框中输入任何值时应显示要求的内容.没有disabled="true",它可以正常工作.我有什么替代选择.

i need to validate textbox for empty validation and should show required when i click button without entering any value in textbox. It works fine without disabled="true". Whats the alternative for my requirement.

推荐答案

disabled="true"禁用输入(因此,在提交表单时将跳过输入),如果您不希望用户使用readonly="readonly"进行输入

disabled="true" disables the input (so it's skipped when the form is submitted), if you don't want the user to type in it use readonly="readonly"

这篇关于为什么required ="true"?当disabled为"true"时,验证不会失败.被指定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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