如何在提交按钮上获取amx迭代器的所有文本框值

时间:2016-08-25 06:36:44

标签: oracle-maf

我想在点击提交按钮时获取所有文本框,选择框,单选按钮值。使用amx:iterator迭代所有输入元素。我已经分享了下面的amx代码。

输入字段是动态的,基于服务器的响应。

<?xml version="1.0" encoding="UTF-8" ?>
<amx:view xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:amx="http://xmlns.oracle.com/adf/mf/amx"
   xmlns:dvtm="http://xmlns.oracle.com/adf/mf/amx/dvt">
   <amx:panelPage id="pp1">
      <amx:facet name="header">
         <amx:outputText value="DynamicPage" id="ot1"/>
      </amx:facet>
      <amx:commandButton text="commandButton1" id="cb1">
         <amx:actionListener id="al1" binding="#{ImageBean.getFormData}"/>
      </amx:commandButton>
      <amx:outputText value="Question Starts" ></amx:outputText>
      <amx:outputText value="Second Question Starts" ></amx:outputText>
      <amx:iterator var="row" value="#{bindings.questionCollection3.collectionModel}" id="i1">
         <!--<amx:outputText value="#{row.questionList.bindings.qid.inputValue}" id="d85" />-->
         <amx:outputText value="#{row.questionList.bindings.qid.inputValue}" />
         <amx:outputText value="#{row.questionList.bindings.qtext.inputValue}" rendered="#{row.questionList.bindings.answertype.inputValue == '3' || row.questionList.bindings.answertype.inputValue == '2' || row.questionList.bindings.answertype.inputValue == '1' || row.questionList.bindings.answertype.inputValue == '0'}" id="ot4" />
         <amx:inputText inputType="text" disabled="#{row.questionList.bindings.qid.inputValue == '0'}" rendered="#{row.questionList.bindings.answertype.inputValue == '0'}"
            value="#{textIterator.txtValue}" valueChangeListener="#{QListBean.getQuestionID}" />
         <amx:inputText inputType="text" rendered="#{row.questionList.bindings.answertype.inputValue == '1'}" rows="4" autoCapitalize="auto" />
         <amx:selectOneRadio value="#{bindings.optionlist1.inputValue}" rendered="#{row.questionList.bindings.answertype.inputValue == '3'}" id="sor1">
            <amx:selectItems value="#{bindings.optionlist1.items}" id="si2"/>
         </amx:selectOneRadio>
         <amx:selectOneChoice value="#{bindings.optionlist1.inputValue}" rendered="#{row.questionList.bindings.answertype.inputValue == '2'}" id="soc1">
            <amx:selectItems value="#{bindings.optionlist1.items}" id="si1"/>
         </amx:selectOneChoice>
      </amx:iterator>
      <amx:commandButton actionListener="#{bindings.getPicture.execute}" text="getPicture"
         disabled="#{!bindings.getPicture.enabled}" id="cb2" action="#{ImageBean.getImages}"/>
      <amx:panelFormLayout id="pfl1">
         <amx:inputText value="#{bindings.quality.inputValue}" label="#{bindings.quality.hints.label}" id="it6"/>
         <amx:inputText value="#{bindings.destinationType.inputValue}" label="#{bindings.destinationType.hints.label}"
            id="it5"/>
         <amx:inputText value="#{bindings.sourceType.inputValue}" label="#{bindings.sourceType.hints.label}" id="it1"/>
         <amx:inputText value="#{bindings.allowEdit.inputValue}" label="#{bindings.allowEdit.hints.label}" id="it3"/>
         <amx:inputText value="#{bindings.encodingType.inputValue}" label="#{bindings.encodingType.hints.label}" id="it2"/>
         <amx:inputText value="#{bindings.targetWidth.inputValue}" label="#{bindings.targetWidth.hints.label}" id="it7"/>
         <amx:inputText value="#{bindings.targetHeight.inputValue}" label="#{bindings.targetHeight.hints.label}" id="it4"/>
      </amx:panelFormLayout>
      <amx:commandButton actionListener="#{bindings.getPicture.execute}" text="getPicture Second"
         disabled="#{!bindings.getPicture.enabled}" id="cb3"/>
   </amx:panelPage>
</amx:view>

先谢谢。

1 个答案:

答案 0 :(得分:1)

根据上面给出的代码,

您可以使用<amx:setPropertyListener>中的属性<amx:commandButton>指定您想要获取相应bean类中的变量的任何值。

例如:<amx:setPropertyListener from="#{row.questionList.bindings.qid.inputValue}" to="#{pageFlowScope.questionId}" type="action">

如果您要查看数据库中的值,最好在actionListener中查询数据库中的值,以获得更好的效果。