Forgive me if there is already an AjaxButton as described below: Currently AjaxButton must be in a form or have a form instance passed into its constructor and has an onSubmit(...) method and is of type="submit" (by omitting type attribute, standards consider it a submit). Proposal:
* add method onClick(...) to AjaxButton, if AjaxButton is in a form or a form has been set on it, and it is of type submit, protected onClick(...) is never called * AjaxButton can be used outside of a form, protected onSubmit(...) will never be called on an AjaxButton that is not in a form (unless a form it is not a descendant of has been passed into the constructor) * When AjaxButton is not in a form, type will be explicitly, automatically, set to type="button" unless template has type="reset" or AttributeModifier is used to set type to reset or a form instance has been passed into the constructor * If AjaxButton is in a form or has had a form passed to it constructor, but type="button" in template or type set to button via ajaxbutton.add(new AttributeModifier("type","button")) then onSubmit(...) will never be called, onClick(...) will be called instead. Purpose: There are many instances where developers use AjaxLink but from an ADA Compliance standpoint that is frowned upon if not used for loading content or navigating content. Links (<a/>) should link to something (go to another page, load additional content into the current page, jump to another location on the current page, etc), Buttons (<button/>) should do something (submit a form, remove or hide an element, reset a form or field, start a client side process, etc). You should never use an <a/> to reset a form, that is what <button type="reset"/> is for, you should never use an <a/> to start a client side program, that is what <button type="button"/> is for. This is important from a semantic markup standpoint, accessibility tools should be able to figure out how to present things without analyzing CSS and JavaScript The AjaxButton should behave exactly like an AjaxLink when it is included in a template where it is not a descendant of a form or where its type has been set to reset or button. Robert Murphy | Software Developer - Rocky Mountain ATV/MC Rocky Mountain ATV/MC - 502.291.2076<tel:+15022912076> Address - 77 E 800 N, Spanish Fork, UT 84660<https://goo.gl/maps/ERSNZK8AK5Bf1Xnh9> Website - www.rockymountainatvmc.com<https://www.rockymountainatvmc.com/>