Hi Gary,
i suppose you are using Ajax, since without ajax it works correctly.

What's going on is basically this :
- The hidden field is rendered in the form instance with a placeholder
- The placeholder does not contains a label, so the <label> html element is generated but is empty - Once the widget becomes visible, a <bu:replace> is generated so that ajax can update the widget status - Unfortunately, ajax only updates the <span> containing the input, and not the connected <label>

IMMO there are cases (like transition from invisible to visible) where a bu:replace should be issued for "the entire widget", which mean the label and even eventually the <tr> that contains the widget, since i would expect an invisible field not to generate a <tr> in a columns layout, but the <tr> to appear when the widget becomes visible, but this is not easy nor tidy to implement.

As a work around, you could try the ajax fine tuning patch found here http://issues.apache.org/jira/browse/COCOON-1774 that should permit you to disable ajax on the triggering widget, thus causing a complete page reload only in that case. If this patch acts as a workaround, then please add a comment on the bug to let other people know and vote for it so that it get included in cocoon faster.

Another really untidy workaround could be to put the field inside a repeater (don't know if other kind of container widgets could work as well) and then force an ajax repeater update. Ajax updates the entire repeater content (table or whatever else) when a row is added or removed from a repeater, so it will update everything. You can trigger a repeater complete ajax update with form.addWidgetUpdate(repeaterWidget).

Anyway, fill a bug in jira ( http://issues.apache.org/jira/browse/COCOON ) for this issue.

If you are brave, you could try to modify the cocoon forms XSL/write a new XSL to act this way :
- put an id on the label elements, something like [inputname]:label.
- when a bu:replace is generated, generate a companion bu:replace for the label.

Hope this is somehow helpful,
Simone


Stewart, Gary wrote:

I've got a form with an invisible item and a radio box that will set it to 
active. It works fine except the label doesn't appear. The definition looks 
something like:

(On the widget):

<fd:on-create>
<fd:javascript>
   
this.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.INVISIBLE);
</fd:javascript>
</fd:on-create>

(On the activating widget):

<fd:on-value-changed>
<fd:javascript>
 var dod_widget = event.source.parent.lookupWidget("dod");
 if(event.source.value == "0")
        {
         
dod_widget.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.INVISIBLE);
         dod_widget.value = "";
        }
  else //1
        {
         
dod_widget.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.ACTIVE);
        }
</fd:javascript>
</fd:on-value-changed>

Is there anything else I need to set to make the label appear? I've tried using the 
column group layout for it and just "manually" having the label in the form but 
neither seem to show the label when the widget becomes active.

Thanks,

Gary

*****************************************************************
The information contained in this message may be confidential or legally privileged and is intended for the addressee only. If you have received this message in error or there are any problems please notify the originator immediately. The unauthorised use, disclosure, copying or alteration of this message is strictly forbidden.
*****************************************************************


If you work for NHS Lothian and wish to have help to stop smoking, support is 
available by contacting [EMAIL PROTECTED] or 0131 537 9494  - internal 49494.  
For anyone else living/working in Lothian, please contact 0800 848484 for your 
nearest NHS stop smoking service.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

--
Simone Gianni

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to