spring-webflow icon indicating copy to clipboard operation
spring-webflow copied to clipboard

Simplify how form submit buttons are decorated [SWF-1276]

Open spring-operator opened this issue 15 years ago • 0 comments

Rossen Stoyanchev opened SWF-1276 and commented

Currently decorating form buttons requires code like this:

Spring.addDecoration(new Spring.ValidateAllDecoration({ elementId : 'rewardButton', event : 'onclick' })); Spring.addDecoration(new Spring.AjaxEventDecoration({ elementId : 'rewardButton', event : 'onclick', formId : 'diningForm' }));

This is boilerplate code varying by button and form id only. It would be nicer to be able to ask Spring JS to decorate all buttons having a specific CSS class.

Example HTML snippet:

<form id="form1"> ... <button id="submit1" class="spring_ajax_submit">Submit 1</button> <button id="submit2" class="spring_ajax_submit">Submit 2</button> </form>

Example JavaScript snippet: Spring.addAjaxEventDecorations('formId', params{fragments:'body'})

Given the above call Spring JS can easily figure out which buttons need to be decorated and add the necessary decorations.


Affects: 2.0.9

Issue Links:

  • #478 Allow DOM element in addition to elementId as input

  • #482 Simplify how links are decorated

spring-operator avatar Mar 19 '09 12:03 spring-operator