cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carlos Chávez <>
Subject Re: [Forms] Bug in Ajax when changing widget state?
Date Mon, 31 Dec 2007 01:43:11 GMT

Hi Grzegorz.

Grzegorz Kossakowski Escribio :-)
> Carlos pisze:
>> Hi People,
> Hi Carlos,
> I found your e-mail little bit broken (weird characters in author field
> for example) that made my
> Thunderbird gone crazy. Is it your e-mail program issue?

I think so.
I'm using the Squirrel mail and it's a encoding problem, if i change to
ISO-8859-1 it show the "a" with the accent.

>> I found the message above that it's an old message, but that still being
>> an
>> issue on CForms.
>> I found that the label field is not visible again because we only sent
>> the
>> <bu:replace> <span id="..."> ...</span> </bu:replace> for
the input
>> field
>> but for the label we don't have anything similar.
>> When we show the form that initially have a field invisible and the
>> field
>> it's on a <fi:group> ... we sent a placeholder for the field and this
>> generate this:
>> <label class="forms placeholder" id="field2:label" for="field2:input"
>> title=""/>
>> and
>> <span id="field2"/>
>> for example for a field "field2" (that is because the XSLT, now we only
>> generate the SAX's event only for the input, the label tag is generate
>> because the XSLT)
> Do you use some non-standard XSLT files? In normal situation it's a
> template duty to generate
> fi:label tags and XSLT only transforms them into HTML. Isn't it a case for
> you?

  I think you missed my point, I did a simple sample using the XSLT from
cocoon, of course the <label> and the <span> it was generated by the
and the fi:label came from the template, the info it was only to show
what is in HTML generated.

>> Now, when we got visible the field, the <bu:replace> <span id="...">
>> it's
>> just only for the field, we don't manage in anyway the label tag.
>> This is similar if the field it's initially visible, when we got
>> invisible
>> the input field is gone, but the label still there because we don't
>> manage
>> the label on the ajax update.
>> This is similar too when we use the <widget-label id="..."> ... tag,
>> this
>> generate the raw text of the label it does not generate the html tag
>> <label ...> and i think we should generate and we should add ad "id"
>> attribute to the <label> tag, so some how we can manage the label tag on
>> a
>> ajax replace.
>> Now, I'm not sure how we can manage the label, we don't generate the
>> label
>> on the SAX events, we generate the label on the XSLT, the thing is how
>> can
>> we know that the ajax update should contains the label replacement? we
>> can
>> generate always and the ajax update try to find the label, but don't
>> generate any error if we don't find, but looks like a hack.
>> any thoughts ?
> My gut feeling is that it's a bug in macros responsible for handling form
> template and generating
> fi:* tags.

Yes, the thing is, we don't generate any info for the label of the widget
we generate the fi:field info what contains the label, then we use this
info in the XSLT to generate the input and the label. I not sure if the
solution is that simple than to sent more info to the XSLT indicating that
we are on a AJAX update and for the input generate the label.

> Before we dig into details of Forms implementation I would
> really like to see form
> definition and form template exhibiting behavior you are talking about.

  This is the sample, i added in the cocoon forms sample:


  function do_testlabelajaxupdate() {
    var form = new Form("forms/testlabelajaxupdate.xml");


   <fd:form xmlns:fd=""

    <fd:field id="field">
      <fd:hint>field hint</fd:hint>
      <fd:help>field help</fd:help>
      <fd:datatype base="string"/>
    <fd:field id="field2" state="invisible">
      <fd:label>field 2</fd:label>
      <fd:hint>field 2 hint</fd:hint>
      <fd:help>field 2 help</fd:help>
      <fd:datatype base="string"/>
    <fd:field id="field3">
      <fd:label>field 3</fd:label>
      <fd:hint>field 3 hint</fd:hint>
      <fd:help>field 3 help</fd:help>
      <fd:datatype base="string"/>
    <fd:action id="show">
      <fd:label>show ...</fd:label>
    <fd:action id="hide">
      <fd:label>hide ...</fd:label>


<page xmlns:ft=""
  <!-- Import the macros that define CForms template elements -->
  <h4 class="samplesGroup">widgets States sample</h4>
  <title>Sample form</title>
    <ft:form-template action="#{$cocoon/continuation/id}.continue"
method="POST" ajax="true">
        <fi:styling layout="columns"/>
          <ft:widget id="field"/>
          <ft:widget id="field2"/>
        <ft:widget-label id="field3"/><ft:widget id="field3"/>
      <ft:widget id="show"/>
      <ft:widget id="hide"/>

> Also, have you tried following construct:
> <ft:widget id="...">
>   <ft:widget-label id="..."/>
> </ft:widget>
> I'm not sure how it will work but it is worth trying :-)

  That does not work ;)

   Carlos Chávez.

> --
> Grzegorz Kossakowski

View raw message