Buttons in XPages are interesting and potentially dangerous elements. They’re dangerous, mainly to less experienced XPages developers, because they have this apparently helpful combo box that immediately attracts the eye for Button type.
Cancel is useful, but to be honest I never set that. All it does, if you look at the source pane, is set immediate=”true”. Based on the level of understanding I’ve got now of tuning events, it makes more sense to set that on the Events panel, on the relevant eventHandler itself. Because that’s what you have to do if you want to add the same functionality to any other type of control.
But Submit is, to my mind, dangerous. Especially to developers who are not living in the source pane yet. That’s because it adds something very significant to the eventHandler – something that’s not visible on the Events panel. It sets save=”true”, which is on the eventHandler’s All Properties Panel, but nowhere else. This means “save all datasources”. So a developer may set the type to Submit, also add SSJS or Simple Actions (which could include saving a datasource), and wonder why they get unexpected saves.
My preference is to just leave Button type as “Button” and handle everything on the eventHandler, as I would for any other control. It reinfornces standard practice for events. And there’s no time saving by using Button type – unless you only want to save all datasources on a page and nothing else – and the potential for risk and duplication of effort.