How do I get the button to be "pressed" submitting input text when "Enter" key is pressed?

46 Views Asked by At

Using just JSF, can I do this ? Or do I need to add in more layers and functionality to the program?

This is what I have so far with it:

 <tr:form usesUpload="true">
    <trh:tableLayout width="100%" cellPadding="10" borderWidth="0"
     id="Table">

     <trh:rowLayout>
      <trh:cellFormat columnSpan="4">
       <ocau:inlineMessage />
      </trh:cellFormat>
     </trh:rowLayout>
         
     <tr:panelBox styleClass="roundedPanelPrimary">
       <trh:rowLayout halign="center">
       <trh:cellFormat halign="center">        
        <tr:inputText styleClass="tabdata" contentStyle="normalContent"
         label="Account Number"
         value="#{fraudSearch.fraudCustomerReqtUIModelBean.accountNumber}"
         accessKey="13"
                                >
          </tr:inputText>


       </trh:cellFormat>
       
       <trh:cellFormat halign="left">
        <tr:commandButton text="Search" id="Search"
         action="#{fraudSearch.getIBSNotesData}" styleClass="Button"
         halign="center"
         >
         </tr:commandButton>
       </trh:cellFormat>       
      </trh:rowLayout>      
     </tr:panelBox>

     <tr:panelBox styleClass="roundedPanelPrimary"
      rendered="#{fraudSearch.displaySearchResults}">
      <trh:tableLayout cellPadding="10" borderWidth="0" id="Table"
       width="100%">
       <trh:rowLayout>
        <tr:panelTabbed position="above" inlineStyle="width:auto">

         <tr:showDetailItem text="IBS Data Extract" id="IBSDataExtract"
          immediate="true">
          <ui:include
           src="/pages/recovery/fraud/displayFraudRPAIBSDataExtract.jspx">
          </ui:include>
         </tr:showDetailItem>
         <!--  
         <tr:showDetailItem text="Non-Monetary Data" id="IBSNonMonData"
          immediate="true">
          <ui:include
           src="/pages/recovery/fraud/displayFraudRPANonMonetaryData.jspx">
          </ui:include>
         </tr:showDetailItem>
         -->
        </tr:panelTabbed>
        
        
        
        
       </trh:rowLayout>
      </trh:tableLayout>
     </tr:panelBox>
    </trh:tableLayout>


   </tr:form>​

So far, I have attempted to add the access key to both the text box and the button, but it doesn't appear to work. Any point in the right direction would be appreciated.

1

There are 1 best solutions below

1
lkdg On

Trinidad provides a defaultCommand within it's formtag, with wich you should be able to do, what you want. See here: tr:form