You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by jnl1 <it...@yahoo.com> on 2008/02/24 16:02:29 UTC

submitOnEvent usage

hi all...

   i'm trying to use submitOnEvent to submit a form when a user hits enter. 
Looking at the docs, it looks like keypressed and "on enter" are the
defaults.  So, all I would need would be a simple:

<s:submitOnEvent for="searchButton" />

I put this in my page, but no luck.  here's my page.

pointers on what i'm doing wrong are greatly appreciated...

thanks

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:c="http://java.sun.com/jstl/core"
      xmlns:t="http://myfaces.apache.org/tomahawk"
      xmlns:s="http://myfaces.apache.org/sandbox"
      xmlns:af="http://xmlns.oracle.com/adf/faces">
<ui:composition>
<h:form id="searchStandardsAllDataStandardsSearchForm">   
	<s:submitOnEvent for="searchButton" /> 
    <h:panelGrid columns="1" width="40%">
        <af:panelHeader styleClass="searchPanel">
            <af:panelForm rows="4" width="40%" styleClass="searchForm">
                <af:inputText 
                	id="criteriaName" 
                
value="#{searchStandardsAllDataStandardsSearchForm.criteria.name}" 
                	label="#{messages['name']}:" 
                	required="false"
                	readOnly="false">
                </af:inputText>
                <af:inputText id="criteriaId"
value="#{searchStandardsAllDataStandardsSearchForm.criteria.id}"
label="#{messages['id']}:" required="false" readOnly="false">
                </af:inputText>
                <af:selectOneChoice id="criteriaCategoryId"
value="#{searchStandardsAllDataStandardsSearchForm.criteria.categoryId}"
label="#{messages['category.id']}:" required="false" readOnly="false"
unselectedLabel=""
valueChangeListener="#{searchStandardsController.populateSubcategories}"
autoSubmit="true">
                    <c:if test="${!empty criteriaCategoryIdBackingList}">
                        <f:selectItems
value="#{criteriaCategoryIdBackingList}" />
                    </c:if>
                </af:selectOneChoice>
                <af:selectOneChoice id="criteriaTypeId"
value="#{searchStandardsAllDataStandardsSearchForm.criteria.typeId}"
label="#{messages['type.id']}:" required="false" readOnly="false"
unselectedLabel="">
                    <c:if test="${!empty criteriaTypeIdBackingList}">
                        <f:selectItems value="#{criteriaTypeIdBackingList}"
/>
                    </c:if>
                </af:selectOneChoice>
                <af:selectOneChoice id="criteriaOrganizationId"
value="#{searchStandardsAllDataStandardsSearchForm.criteria.organizationId}"
label="#{messages['organization.id']}:" required="false" readOnly="false"
unselectedLabel="">
                    <c:if test="${!empty
criteriaOrganizationIdBackingList}">
                        <f:selectItems
value="#{criteriaOrganizationIdBackingList}" />
                    </c:if>
                </af:selectOneChoice>
                <af:selectOneChoice id="criteriaGroupId"
value="#{searchStandardsAllDataStandardsSearchForm.criteria.groupId}"
label="#{messages['group.id']}:" required="false" readOnly="false"
unselectedLabel="">
                    <c:if test="${!empty criteriaGroupIdBackingList}">
                        <f:selectItems value="#{criteriaGroupIdBackingList}"
/>
                    </c:if>
                </af:selectOneChoice>
                <af:selectOneChoice id="criteriaSubcategoryId"
value="#{searchStandardsAllDataStandardsSearchForm.criteria.subcategoryId}"
label="#{messages['subcategory.id']}:" required="false" readOnly="false"
unselectedLabel="">
                    <c:if test="${!empty criteriaSubcategoryIdBackingList}">
                        <f:selectItems
value="#{criteriaSubcategoryIdBackingList}" />
                    </c:if>
                </af:selectOneChoice>
                <af:selectOneChoice id="criteriaStatusId"
value="#{searchStandardsAllDataStandardsSearchForm.criteria.statusId}"
label="#{messages['status.id']}:" required="false" readOnly="false"
unselectedLabel="">
                    <c:if test="${!empty criteriaStatusIdBackingList}">
                        <f:selectItems
value="#{criteriaStatusIdBackingList}" />
                    </c:if>
                </af:selectOneChoice>
            </af:panelForm>
        </af:panelHeader>
        <af:panelButtonBar styleClass="floatleft">
            <af:commandLink 
            	id="searchButton"
            	text="#{messages['search']}" 
            	action="#{searchStandardsController.allDataStandardsSearch}" 
            	styleClass="lightbutton"/>
        </af:panelButtonBar>
    </h:panelGrid>
</h:form>
</ui:composition>
</html>

-- 
View this message in context: http://www.nabble.com/submitOnEvent-usage-tp15664955p15664955.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: submitOnEvent usage

Posted by Gerald Müllan <ge...@gmail.com>.
Hi,

the global event should work, as it is also documented at

http://example.irian.at/example-sandbox-20080225/submitOnEventGlobal.jsf

Have you tried it with a non-trinidad commandLink/commandButton?

Any js related errors?

cheers,

Gerald

On Sun, Feb 24, 2008 at 4:02 PM, jnl1 <it...@yahoo.com> wrote:
>
>  hi all...
>
>    i'm trying to use submitOnEvent to submit a form when a user hits enter.
>  Looking at the docs, it looks like keypressed and "on enter" are the
>  defaults.  So, all I would need would be a simple:
>
>  <s:submitOnEvent for="searchButton" />
>
>  I put this in my page, but no luck.  here's my page.
>
>  pointers on what i'm doing wrong are greatly appreciated...
>
>  thanks
>
>  <html xmlns="http://www.w3.org/1999/xhtml"
>       xmlns:ui="http://java.sun.com/jsf/facelets"
>       xmlns:h="http://java.sun.com/jsf/html"
>       xmlns:f="http://java.sun.com/jsf/core"
>       xmlns:c="http://java.sun.com/jstl/core"
>       xmlns:t="http://myfaces.apache.org/tomahawk"
>       xmlns:s="http://myfaces.apache.org/sandbox"
>       xmlns:af="http://xmlns.oracle.com/adf/faces">
>  <ui:composition>
>  <h:form id="searchStandardsAllDataStandardsSearchForm">
>         <s:submitOnEvent for="searchButton" />
>     <h:panelGrid columns="1" width="40%">
>         <af:panelHeader styleClass="searchPanel">
>             <af:panelForm rows="4" width="40%" styleClass="searchForm">
>                 <af:inputText
>                         id="criteriaName"
>
>  value="#{searchStandardsAllDataStandardsSearchForm.criteria.name}"
>                         label="#{messages['name']}:"
>                         required="false"
>                         readOnly="false">
>                 </af:inputText>
>                 <af:inputText id="criteriaId"
>  value="#{searchStandardsAllDataStandardsSearchForm.criteria.id}"
>  label="#{messages['id']}:" required="false" readOnly="false">
>                 </af:inputText>
>                 <af:selectOneChoice id="criteriaCategoryId"
>  value="#{searchStandardsAllDataStandardsSearchForm.criteria.categoryId}"
>  label="#{messages['category.id']}:" required="false" readOnly="false"
>  unselectedLabel=""
>  valueChangeListener="#{searchStandardsController.populateSubcategories}"
>  autoSubmit="true">
>                     <c:if test="${!empty criteriaCategoryIdBackingList}">
>                         <f:selectItems
>  value="#{criteriaCategoryIdBackingList}" />
>                     </c:if>
>                 </af:selectOneChoice>
>                 <af:selectOneChoice id="criteriaTypeId"
>  value="#{searchStandardsAllDataStandardsSearchForm.criteria.typeId}"
>  label="#{messages['type.id']}:" required="false" readOnly="false"
>  unselectedLabel="">
>                     <c:if test="${!empty criteriaTypeIdBackingList}">
>                         <f:selectItems value="#{criteriaTypeIdBackingList}"
>  />
>                     </c:if>
>                 </af:selectOneChoice>
>                 <af:selectOneChoice id="criteriaOrganizationId"
>  value="#{searchStandardsAllDataStandardsSearchForm.criteria.organizationId}"
>  label="#{messages['organization.id']}:" required="false" readOnly="false"
>  unselectedLabel="">
>                     <c:if test="${!empty
>  criteriaOrganizationIdBackingList}">
>                         <f:selectItems
>  value="#{criteriaOrganizationIdBackingList}" />
>                     </c:if>
>                 </af:selectOneChoice>
>                 <af:selectOneChoice id="criteriaGroupId"
>  value="#{searchStandardsAllDataStandardsSearchForm.criteria.groupId}"
>  label="#{messages['group.id']}:" required="false" readOnly="false"
>  unselectedLabel="">
>                     <c:if test="${!empty criteriaGroupIdBackingList}">
>                         <f:selectItems value="#{criteriaGroupIdBackingList}"
>  />
>                     </c:if>
>                 </af:selectOneChoice>
>                 <af:selectOneChoice id="criteriaSubcategoryId"
>  value="#{searchStandardsAllDataStandardsSearchForm.criteria.subcategoryId}"
>  label="#{messages['subcategory.id']}:" required="false" readOnly="false"
>  unselectedLabel="">
>                     <c:if test="${!empty criteriaSubcategoryIdBackingList}">
>                         <f:selectItems
>  value="#{criteriaSubcategoryIdBackingList}" />
>                     </c:if>
>                 </af:selectOneChoice>
>                 <af:selectOneChoice id="criteriaStatusId"
>  value="#{searchStandardsAllDataStandardsSearchForm.criteria.statusId}"
>  label="#{messages['status.id']}:" required="false" readOnly="false"
>  unselectedLabel="">
>                     <c:if test="${!empty criteriaStatusIdBackingList}">
>                         <f:selectItems
>  value="#{criteriaStatusIdBackingList}" />
>                     </c:if>
>                 </af:selectOneChoice>
>             </af:panelForm>
>         </af:panelHeader>
>         <af:panelButtonBar styleClass="floatleft">
>             <af:commandLink
>                 id="searchButton"
>                 text="#{messages['search']}"
>                 action="#{searchStandardsController.allDataStandardsSearch}"
>                 styleClass="lightbutton"/>
>         </af:panelButtonBar>
>     </h:panelGrid>
>  </h:form>
>  </ui:composition>
>  </html>
>
>  --
>  View this message in context: http://www.nabble.com/submitOnEvent-usage-tp15664955p15664955.html
>  Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>



-- 
http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces