cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christoph Hermann <>
Subject Re: Repost from users list: Cforms Repeater - Cancel delete action via javascript
Date Tue, 30 Aug 2005 13:18:08 GMT
Sylvain Wallez schrieb:


>> So i'm asking you: Is there a way to cancel a repeaters delete-row
>> action in case a certain condition is met?

> Hmm... the delete-row action accepts additional listeners, but those are
> not supposed to be able to cancel the action. The "Invalid return" error
> you get is because the on-action is a script snippet that has no return
> value.

Ok, thanks for making this point clear.

> To achieve what you want, you should use a plain action widget with an
> on-action that surrounds the row deletion with the filtering logic.

Yes, that was one solution we already came up with, but i thought there
would be a better way to do this stuff.

Just for the archives, here is my solution:
    <fd:action id="myid" repeater="myrepeater" select="select">
      <fd:label>Remove selected</fd:label>
		var form = event.source.form;
		var repeater = form.lookupWidget("myrepeater");
		var row;
		var message;
		for (var i=repeater.size-1; i &gt;= 0; i--) {
			row = repeater.getRow(i);
			if (row.lookupWidget("select").getValue().equals(true)) {
					// print ("Not deleting!");
					message = i18n("MyCatalogue","You cannot delete sth that is still
				} else {
					// print ("Deleting!");

Thanks for your help!

View raw message