You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by Apache Wiki <wi...@apache.org> on 2005/11/24 08:06:03 UTC
[Myfaces Wiki] Update of "SubmitPageOnValueChange" by MarioIvankovits
Dear Wiki user,
You have subscribed to a wiki page or wiki category on "Myfaces Wiki" for change notification.
The following page has been changed by MarioIvankovits:
http://wiki.apache.org/myfaces/SubmitPageOnValueChange
------------------------------------------------------------------------------
In the previous example, if you don't want your button to be seen, use the style style="visibility:hidden;", so the button is hidden and the effect is better :-)
+ == How To Submit a page when an input control value changes (simplified) ==
+
+ If you do not need navigation rules to apply, you can do this:
+
+ === Example ===
+
+ {{{
+ <f:view>
+ <h:form>
+
+ <h:selectOneMenu
+ onchange="submit()"
+ value="#{page.physicalLocation}"
+ title="No location selected"
+ required="true"
+ valueChangeListener="#{page.menuChanged}">
+ <f:selectItems
+ value="#{page.locationItems}"/>
+ </h:selectOneMenu>
+
+ </h:form>
+ </f:view>
+ }}}
+
+ 1. less javascript
+ 1. no need to use "id"s
+
+ If you need to update model values (e.g. to fill a second menu) in your valueChangeListener, please see here: http://issues.apache.org/jira/browse/MYFACES-864
+
+
+ == How To Submit a page when hitting "enter" ==
+
Here's another example provided by Bruno Aranda. It is doing a form submission with just a text field for something like a quick search. It works as follows:
1. Include this javascript in the {{{<head>}}}