You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Jan Hoskens <jh...@schaubroeck.be> on 2004/02/02 10:00:42 UTC

[woody] enable/disable button

Hi,

I have a repeater which has 'original' and 'new' rows.I've got a row-action
add-after for each of them, but I only want a delete-row on the rows that
were created by the user.

example (+ and - are the buttons):

row1(original, from database)                      : name | address | +
row2(through previous +, created by user)   : name | address | + | -

Thus the user can create additional rows that initially start with the
values from the original row (by copying every value explicitly,
http://marc.theaimsgroup.com/?l=xml-cocoon-users&m=107539408229366&w=2) and
with each user-created row, a delete button should be available.

I thought of handling this in a piece of javascript when the xml document is
binded to the form. At that moment I know which rows are labeled 'original'
so I want to disable/remove the row-action widget that handles the delete
for those rows. If the user presses the add-after action, it also should
create the delete button and show it. I was looking for something like
enable/disable at first, but did not find anything alike. I thought to just
remove the widget from those rows (in the javascript) but there isn't a way
to remove a widgets from a row (as far as I know).

Any ideas to do this?

Thankz,

Jan


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


REPOST: [woody] enable/disable button

Posted by Jan Hoskens <jh...@schaubroeck.be>.
Hi again,

I managed to disable my rowbutton by adding an element with a value that's
filled in by an output widget. This output widget's value is filled in
through a piece of javascript during the binding:

<wb:javascript id="disabled" path="." direction="load">
   <wb:load-form>
     if (jxpathContext.getValue("@original") != null)
     {
      widget.setValue("true");
     }
     else
     {
      widget.setValue("false");
     }
   </wb:load-form>
  </wb:javascript>

I use this output widget to just set a value of an extra element:

<wt:widget id="removeRowButton"/><ExtraAttribute name="disabled"><wt:widget
id="disabled"/></ExtraAttribute>

This is filled in by woody template transformer and in my final xsl
stylesheet I just add this element as an attribute to the 'removeRowButton'.
This results in adding an attribute disabled='true' when an element
'ExtraAttribute' is found after an input element.
So far so good, that's what I thought, but when I add a row, the button is
also disabled, so now I'm stuck with enabling the same button again for new
row entries.

While thinking about this, I realize that this isn't the way to do this.
Actually I want to set some of the woody styling attributes at binding time
and I want to access them when a row is added. How can I do this? I've
looked at the api and saw something like 'display data'. Is this where the
styling is done? If so, how do I use it, if not, where/how can I add styling
attributes to a widget from within the binding and in the definition(when
adding a row I need to access them)?

Maybe any other ideas?

Thankz,

Jan

----- Original Message ----- 
From: "Jan Hoskens" <jh...@schaubroeck.be>
To: <us...@cocoon.apache.org>
Sent: Monday, February 02, 2004 10:00 AM
Subject: [woody] enable/disable button


> Hi,
>
> I have a repeater which has 'original' and 'new' rows.I've got a
row-action
> add-after for each of them, but I only want a delete-row on the rows that
> were created by the user.
>
> example (+ and - are the buttons):
>
> row1(original, from database)                      : name | address | +
> row2(through previous +, created by user)   : name | address | + | -
>
> Thus the user can create additional rows that initially start with the
> values from the original row (by copying every value explicitly,
> http://marc.theaimsgroup.com/?l=xml-cocoon-users&m=107539408229366&w=2)
and
> with each user-created row, a delete button should be available.
>
> I thought of handling this in a piece of javascript when the xml document
is
> binded to the form. At that moment I know which rows are labeled
'original'
> so I want to disable/remove the row-action widget that handles the delete
> for those rows. If the user presses the add-after action, it also should
> create the delete button and show it. I was looking for something like
> enable/disable at first, but did not find anything alike. I thought to
just
> remove the widget from those rows (in the javascript) but there isn't a
way
> to remove a widgets from a row (as far as I know).
>
> Any ideas to do this?
>
> Thankz,
>
> Jan
>
>
> ---------------------------------------------------------------------
> 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