JSF Form Submit works in FF, but not in IE

I have a simple form with inputText and commandButton.

<h:form> <h:inputText id="xyz" value="#{viewImpl.field}" onfocus="clearText(this)" onblur="setDefaultText(this)" /> <h:commandButton action="#{viewImpl.method}"/> </h:form> 

If I click on commandButton, the form will be submitted correctly. But if I hit enter while still in inputText-Field, the page reloads, but the method is not called (the server is in debug mode with breakpoints activated).

Important: This only happens in IE 8. It works fine in Firefox. Any clue on how I can fix this?

Thanks a lot!

+4
source share
1 answer

This is a known issue with single-field forms in IE. Pressing the enter key does not call the "first-next" button of the form, and therefore its name = value pair will not be displayed on the query parameters map, and therefore, JSF will not be able to identify the button to queue the action event.

One way to fix this is to add a second, but invisible input field to the same form.

 <input type="text" name="dummy" style="display: none;" /> 

This will cause IE to also send a name = value pair to the first-next button.

+5
source

Source: https://habr.com/ru/post/1469027/


All Articles