You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Mark Lundquist <ml...@wrinkledog.com> on 2004/03/16 10:20:02 UTC
[forms+flow] repeater widget onClick property
I'm using Cocoon 2.1.5_dev w/ the v2 forms+flow API...
I've got an <fd:action> as a child of a repeater. This is supposed to
be a "Delete" button that calls removeRow() on the repeater for its
row, but I can't figure out how to know, within the fd:action's onClick
handler, the index of the row whose delete button submitted the form.
Is there a nice way to do this?
Thanks a lot,
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: [forms+flow] repeater widget onClick property
Posted by Christopher Oliver <re...@verizon.net>.
This should work:
button.onClick = function() {
var row = button.getParent();
var repeater = row.getParent();
repeater.removeRow(parseInt(row.getId()))
}
But I think it would be a good idea to add a getRowIndex() to the JS
RepeaterRow object. Maybe a remove() operation should be added to JS
RepeaterRow as well.
Chris
Mark Lundquist wrote:
> I'm using Cocoon 2.1.5_dev w/ the v2 forms+flow API...
>
> I've got an <fd:action> as a child of a repeater. This is supposed to
> be a "Delete" button that calls removeRow() on the repeater for its
> row, but I can't figure out how to know, within the fd:action's
> onClick handler, the index of the row whose delete button submitted
> the form.
>
> Is there a nice way to do this?
>
> Thanks a lot,
> Mark
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: [forms+flow] repeater widget onClick property
Posted by Mark Lundquist <ml...@wrinkledog.com>.
On Mar 16, 2004, at 1:38 AM, Vasyl Stashuk wrote:
> Mark Lundquist wrote:
>
>> I'm using Cocoon 2.1.5_dev w/ the v2 forms+flow API...
>>
>> I've got an <fd:action> as a child of a repeater. This is supposed
>> to be a "Delete" button that calls removeRow() on the repeater for
>> its row, but I can't figure out how to know, within the fd:action's
>> onClick handler, the index of the row whose delete button submitted
>> the form.
> <snip...>
> I have the same problem. The best solution i found so far is to refer
> by form's submit widget, i.e.:
>
> var selected =
> form.getWidget().getSubmitWidget().getParent().getWidget("id").value;
Thanks... getWidget("id") didn't work for me — it returned null, as did
getWidget("rowID") which I saw on some Wiki page that Joerg referenced,
so maybe that's out of date w.r.t. the version of Cocoon I'm using.
getID() per Chris Oliver's suggestion worked.
> By the way, how do you install repeater's fd:action onClick handler?
From flowscript, you assign to the 'onClick' property of the
<fd:action> widget. For instance, if you have a row object in a
repeater containing a <fd:action> named someButton as a child, you can
write:
row.someButton.onClick = function () { ...whatever };
I believe you need to be using the "v2" forms+flow integration for this
to work.
~ Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: [forms+flow] repeater widget onClick property
Posted by Vasyl Stashuk <va...@acm.org>.
Mark Lundquist wrote:
> I'm using Cocoon 2.1.5_dev w/ the v2 forms+flow API...
>
> I've got an <fd:action> as a child of a repeater. This is supposed to
> be a "Delete" button that calls removeRow() on the repeater for its
> row, but I can't figure out how to know, within the fd:action's
> onClick handler, the index of the row whose delete button submitted
> the form.
>
> Is there a nice way to do this?
>
> Thanks a lot,
> Mark
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
I have the same problem. The best solution i found so far is to refer by
form's submit widget, i.e.:
var selected =
form.getWidget().getSubmitWidget().getParent().getWidget("id").value;
By the way, how do you install repeater's fd:action onClick handler?
vasyas
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org