1 Reply Latest reply on Jun 13, 2011 11:11 PM by Nick Belaevski

    How to disable submit action from a <h:inputText> field in a form?

    erickson Newbie

      Hi everyone,

       

      In the example below, when I press Enter key in the inputText a submit action is invoked. How to disable this?

       

      1. <h:form>
      2.          <h:inputText value="" />
      3.          <h:commandButton action="#{myaction.beginConv}" value="new Conversation" />
      4. </h:form>

       

      the associated action:

       

      1. import java.io.Serializable;
      2. import org.jboss.seam.ScopeType;
      3. import org.jboss.seam.annotations.AutoCreate;
      4. import org.jboss.seam.annotations.Begin;
      5. import org.jboss.seam.annotations.Name;
      6. import org.jboss.seam.annotations.Scope;
      7. @Scope(value=ScopeType.CONVERSATION)
      8. @Name(value="myaction")
      9. @AutoCreate
      10. public class myAction implements Serializable {
      11.         private static final long serialVersionUID = -7841475921399951330L;
      12.         @Begin(nested=true)
      13.         public String inicia() {}
      14. }

       

      When  the button "new Conversation" is clicked starts a new conversation, the same happens if the Enter key is pressed when the cursor is in inputText field.

       

      (setting a project with seam 2.2.0GA, using jboss-5.1.0GA and deploying the project as an ear)

       

      Sorry for my bad english.