【问题标题】:validating dynamic textbox2 based on entered value in textbox1 in rich table根据富表中 textbox1 中输入的值验证动态 textbox2
【发布时间】:2011-05-27 11:15:54
【问题描述】:

我正在使用rich:dataTable 动态创建组件,每行中的组件是复选框、text1、text2。我能够创建/删除行。我为 text1 和 text2 添加了验证器。

我需要根据 text1 中输入的字符来验证 text2。假设在 text1 组件中输入 3,那么在 text2 组件中我需要允许最多 3 个字符。这需要对整个表的所有动态生成的行进行。

<rich:dataTable id ="outtable" value="#{bean.Items}" var="row">
    <rich:column>
            <f:facet name="header">
                    <h:outputText id="selectrow" value="select" style="font-weight: bold; font-family: Arial, Verdana, Helvetica, sans-serif; font-size: 12px;" />
            </f:facet>
            <h:selectBooleanCheckbox value="#{row.selected}" />
    </rich:column>
    <rich:column>
            <f:facet name="header">
                    <h:outputText size="15" value="Bean Value" 
                    style="font-weight: bold; font-family: Arial, Verdana, Helvetica, sans-serif; font-size: 12px;"/>
            </f:facet>
            <s:decorate id="valueDecoration" template="layout/edit.xhtml">
            <h:inputText  size="8" maxlength="4" value="#{row.beanValue}" required="true" >
                <f:validator validatorId="beanValueValidator"/>
                <s:validate/>
                <a:support event="onblur" reRender="valueDecoration"  bypassUpdates="false" ajaxSingle="true"/>
            </h:inputText>
           </s:decorate>      
    </rich:column>
    <rich:column>
            <f:facet name="header">
                    <h:outputText  value="Bean Data" 
                    style="font-weight: bold; font-family: Arial, Verdana, Helvetica, sans-serif; font-size: 12px;"/>
            </f:facet>
            <s:decorate id="dataDecoration" template="layout/edit.xhtml">                                   
            <h:inputText size="30" maxlength="40" value="#{row.beanData}" required="true">
              <f:validator validatorId="beanDataValidator"/>
              <s:validate/>
              <a:support event="onblur" reRender="dataDecoration" bypassUpdates="false" ajaxSingle="true" />                                    
            </h:inputText>
            </s:decorate> 
    </rich:column>
    <f:facet name="footer">
            <h:panelGroup>                                          
                    <h:commandButton value="Add Row" action="#{bean.add}"  />
                    <h:commandButton value="Delete Selected" action="#{bean.remove}"  />
            </h:panelGroup>
    </f:facet>
</rich:dataTable>

我怎样才能做到这一点?

【问题讨论】:

    标签: jsf jsf-2 richfaces


    【解决方案1】:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多