You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by vi...@wipro.com on 2005/09/29 15:51:31 UTC

How to set onChange event handler for widgets defined inside union/group

Hi,

Can any one help me out..

How to define onChange event-handler for the widgets defined inside the
union?

What's wrong in the below code?

//flow script code

wid.lookupWidget('description_c').setValue('visible');

wid.lookupWidget('description_u/visible/description').onChange =
function (oldV, newV) {
    print("oldV::" + oldV);
    print("newV::" + newV);
};

//definition file

<fd:union id="description_u" case="description_c">
  <fd:widgets>
    <fd:struct id="visible">
      <fd:widgets>
        <fd:field id="description">
          <fd:datatype base="string" /> 
          <fd:selection-list> 
            <!-- TODO remove the below code   -->
            <fd:item value="1">
              <fd:label><i18n:text>test</i18n:text></fd:label>
            </fd:item>
            <fd:item value="2">
              <fd:label><i18n:text>test2</i18n:text></fd:label>
            </fd:item>
          </fd:selection-list>
        </fd:field>
      </fd:widgets> 
    </fd:struct>
    <fd:struct id="disabled">
      <fd:widgets></fd:widgets>
    </fd:struct>
    <fd:struct id="hidden">
      <fd:widgets></fd:widgets>
    </fd:struct>
  </fd:widgets>
</fd:union>
   

//template file

<ft:union id="description_u">
  <ft:case id="visible">
    <ft:struct id="visible">
      <!-- insert regular header row HTML stuff here -->
      <ft:widget id="description">
        <fi:styling submit-on-change="true" />
      </ft:widget>
    </ft:struct>
  </ft:case>
  <ft:case id="disabled">
    <ft:struct id="disabled">
      <!-- insert regular header row HTML stuff here -->
      <p>Please choose a Phone value first.</p>
    </ft:struct>
  </ft:case>
  <ft:case id="hidden">
     <p>hidden value</p>
  </ft:case>
</ft:union>

Vijay.




Confidentiality Notice

The information contained in this electronic message and any attachments to this message are intended
for the exclusive use of the addressee(s) and may contain confidential or privileged information. If
you are not the intended recipient, please notify the sender at Wipro or Mailadmin@wipro.com immediately
and destroy all copies of this message and any attachments.