Monday, May 14, 2007

how to deal with blank rows on multi-forms

If you use simple methods to create multi-row form, you might notice that if there is an error in one row, any blank rows in the form will cause validation errors. You might think that the "if-not-empty" tag in the SimpleMethods.xml definition would cause the form to ignore blank rows, but it doesn't. The reason is that by default, a multi-form is treated as one big transaction. When one of the rows fails validation, they all do.

The solution is to use the global-transaction="false" attribute in the event tag in controller.xml . This tells the event called that you want the form to be processed as individual lines instead of as one big form.