Hi Michael, Happy new year too!
type="button" is not a valid value on jsf 1.2, see the renderkit documentation of the attribute "type" from javax.faces.Button: »Type of button to create. Valid values are "submit" and "reset". If not specified, or not a valid value, the default value is "submit".« In jsf 1.1, the type attribute was only a pass-through feature, values were passed to the HTML type attribute without changes. However, in jsf 2.0 the renderkit documentation was changed to: »Type of button to create. Valid values are "submit", "button", and "reset". If not specified, or not a valid value, the default value is "submit".« I don't really know why they banned type="button" from jsf 1.2, but I guess it has something to do with a javascript api not beeing present in the 1.2 spec. But that's just a guess. In jsf 2.0 the client behaviours and f:ajax were introduced, so there was a need for type="button". Furthermore in jsf 1.2 you must not put an h:commandButton outside an h:form, in jsf 2.0 it is allowed. If I were you I would add "return false" to the onclick attribute of the h:commandButton, but that's just my opinion. Hope this helps and explains things! Regards, Jakob 2010/1/1 Michael Heinen <[email protected]> > Happy new year! > > A question regarding commandButtons. > I noticed that the attribute type="button" is not working anymore. > > type="button" is rendered with myfaces 1.1.5. > type="submit" is rendered with myfaces 1.2.8. > > Is this expected behavior according to spec or is it a bug? > > myfaces 1.2.8 > > org.apache.myfaces.shared_impl.renderkit.html.HtmlButtonRendererBase.encodeEnd() > Line 116: > String type = getType(uiComponent); > if (type == null || !isReset(uiComponent)) > { > type = HTML.INPUT_TYPE_SUBMIT; > } > > myfaces 1.1.5 > String type = getType(uiComponent); > if (type == null) { > type = HTML.INPUT_TYPE_SUBMIT; > } > > Type "submit" is set now if type is not Reset! > > Same is true for > org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlButtonRendererBase.encodeEnd() > > Workarounds are obvious: > a) patch HtmlButtonRendererBase locally and remove isReset check > b) add 'return false;' to the onclick attributes of all these buttons > c) write html directly > > Question: > Should I create a Jira issue for this or is this working correctly in > myfaces 1.2.8 and was a bug in myfaces 1.1.5? > > Michael >

