You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Kamal Bhatt <kb...@tt.com.au> on 2006/03/07 08:18:10 UTC

Cannot find group

Hi
I would like to create an action on a repeater that copies some of  the 
values of a row into a group of other fields (the fields having similar 
sort of values). This action should take place when an action on a row 
is selected.

 Here are the relevant parts of the code :
---

    <!-- INFORMATION REPEATER -->
    <fd:repeater id="information">
      <fd:label>Information</fd:label>
      <fd:widgets>
        <fd:output id="id">
          <fd:datatype base="integer"/>
        </fd:output>
       
        <fd:booleanfield id="select"/>
       
        <fd:output id="position"><fd:datatype base="integer"/></fd:output>

        <fd:field id="heading" required="false">
          <fd:label>Heading</fd:label>
          <fd:datatype base="string"/>
        </fd:field>
       
        <fd:field id="sub_heading" required="false">
          <fd:label>Sub Heading</fd:label>
          <fd:datatype base="string"/>
        </fd:field>
       
        <fd:booleanfield id="list_item">
          <fd:label>Display text as bullet</fd:label>
        </fd:booleanfield>

        <fd:field id="text" required="false">
          <fd:label>Text</fd:label>
          <fd:datatype base="string"/>
        </fd:field>
   
        <fd:field id="icompType">
            <fd:label>Type</fd:label>
            <fd:datatype base="string"/>
        </fd:field>   
        <fd:field id="icompCity">
            <fd:label>City</fd:label>
            <fd:datatype base="string"/>
        </fd:field>   
        <fd:field id="icompCode">
            <fd:label>Code</fd:label>
            <fd:datatype base="string"/>
        </fd:field>   
        <fd:field id="iname">
            <fd:label>Name</fd:label>
            <fd:datatype base="string"/>
        </fd:field>   
       
       
        <!-- Edit Information -->
        <fd:action id="edit_information" command="edit-information">
           <fd:label>Edit</fd:label>
           <fd:on-action>
            <fd:javascript>
                 var selectedRow = event.source.getParent();
                 var indexOfSelectedRow = selectedRow.getId();
                 var informEdit = 
event.source.getForm().getChild("info_edit");
                
                 
selectedRow.lookupWidget("../../active_repeater").setValue("information");
                 
selectedRow.lookupWidget("../../active_element").setValue(parseFloat(indexOfSelectedRow));
                
                 
informEdit.getChild("heading_edit").setValue(selectedRow.getChild("heading").getValue());
                 
informEdit.getChild("sub_heading_edit").setValue(selectedRow.getChild("sub_heading").getValue());     

                 
informEdit.getChild("sub_heading_edit").setValue(selectedRow.getChild("sub_heading").getValue());
                 
informEdit.getChild("list_item_edit").setValue(selectedRow.getChild("list_item").getValue());
                 
informEdit.getChild("text_edit").setValue(selectedRow.getChild("text").getValue());
                 
informEdit.getChild("icompType_edit").setValue(selectedRow.getChild("icompType").getValue());
                 
informEdit.getChild("icompCity_edit").setValue(selectedRow.getChild("icompCity").getValue());
                 
informEdit.getChild("icompCode_edit").setValue(selectedRow.getChild("icompCode").getValue());
                 
informEdit.getChild("iname_edit").setValue(selectedRow.getChild("iname").getValue());
                
                 informEdit.setState(WidgetState.ACTIVE);
            </fd:javascript>
           </fd:on-action>
        </fd:action>
      </fd:widgets>
    </fd:repeater>   
   
    <!-- END INFORMATION REPEATER -->

    <fd:group id="info_edit">
        <fd:widgets>
        <fd:field id="heading_edit" required="false">
          <fd:label>Heading</fd:label>
          <fd:datatype base="string"/>
        </fd:field>
       
        <fd:field id="sub_heading_edit" required="false">
          <fd:label>Sub Heading</fd:label>
          <fd:datatype base="string"/>
        </fd:field>
       
        <fd:booleanfield id="list_item_edit">
          <fd:label>Display text as bullet</fd:label>
        </fd:booleanfield>

        <fd:field id="text_edit" required="false">
          <fd:label>Text</fd:label>
          <fd:datatype base="string"/>
        </fd:field>
   
        <fd:field id="icompType_edit">
            <fd:label>Type</fd:label>
            <fd:datatype base="string"/>
        </fd:field>   
        <fd:field id="icompCity_edit">
            <fd:label>City</fd:label>
            <fd:datatype base="string"/>
        </fd:field>   
        <fd:field id="icompCode_edit">
            <fd:label>Code</fd:label>
            <fd:datatype base="string"/>
        </fd:field>   
        <fd:field id="iname_edit">
            <fd:label>Name</fd:label>
            <fd:datatype base="string"/>
        </fd:field>   
       
       
        <!-- Edit Information -->
        <fd:action id="return_information" command="return-information">
           <fd:label>OK</fd:label>
           <fd:on-action>
            <fd:javascript>
//                 var selectedRepeater = 
event.source.lookupWidget("../../" + 
event.source.lookupWidget("../../active_repeater"));
                 var selectedElement = 
event.source.lookupWidget("../../active_element");

                 var repeater = 
event.source.lookupWidget("../../information");

                 var row = repeater.getRow(selectedElement);

                 var informEdit = event.source.getParent();

                 
row.getChild("heading").setValue(informEdit.getChild("heading_edit").getValue());
                 
row.getChild("sub_heading").setValue(informEdit.getChild("sub_heading_edit").getValue());
                 
row.getChild("list_item").setValue(informEdit.getChild("list_item_edit").getValue());
                 
row.getChild("text").setValue(informEdit.getChild("text_edit").getValue());
                 
row.getChild("icompType").setValue(informEdit.getChild("icompType_edit").getValue());
                 
row.getChild("icompCity").setValue(informEdit.getChild("icompCity_edit").getValue());
                 
row.getChild("icompCode").setValue(informEdit.getChild("icompCode_edit").getValue());
                 
row.getChild("iname").setValue(informEdit.getChild("iname_edit").getValue());
               
                 informEdit.setState(WidgetState.INVISIBLE);
            </fd:javascript>
           </fd:on-action>
        </fd:action>
      </fd:widgets>
    </fd:group>

---
When I click on the action however, the fields that were displayed are 
blanked out and the fields in the group have no values in them. Am I 
missing something? We only display a subset of the rows in the group and 
the repeaters, would that have an affect? We are currently on cocoon 2.1.7.

TIA.

-- 
Kamal Bhatt



--
Disclaimer: This email is confidential and may contain privileged information for the sole use of the person or business to which it is addressed. If you are not the intended recipient, please notify the sender by return e-mail or phone as you must not view, disseminate, distribute or copy this email without our consent. We do not accept any liability in connection with any computer virus, data corruption, incompleteness, or unauthorised amendment of this email. It is the sole responsibility of the receiver to scan for viruses before opening.

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


Re: New Problem.

Posted by Kamal Bhatt <kb...@tt.com.au>.
Stupid me, should have set the state to invisible.

Kamal Bhatt wrote:

>
> Sorry, I should clarify myself:
>
> informEdit.getChild("list_item_edit").setValue(selectedRow.getChild("list_item").getValue()); 
>
>
> does not work. list_item and list_item_edit are boolean fields.
>
> To confuse matters more,  I tried the following code:
>
> selectedRow.getChild("list_item").setValue(true);
> var list_item = selectedRow.getChild("list_item").getValue();
> if (list_item == true) cocoon.log.error("hello");
>
> and it turns out that true != true, because "hello" does not print.
>
> I have even put debugging statements in BooleanField.java and it 
> remains false.
>
> What am I doing wrong?
>
> Kamal Bhatt wrote:
>
>>
>> OK, this is fixed, I used getForm instead of looking up the field, 
>> that seems to work.  Now I have another problem. I am trying to copy 
>> the boolean field to/from the repeater, but it doesn't work.
>>
>> It is always set to false. I would prefer being able to set this like 
>> the other values that way I could create a general function to copy 
>> to/from a repeater row to/from a group of fields with the same names.
>>
>> Cheers.
>>
>
>


-- 
Kamal Bhatt

Tourism Technology Pty Ltd


T:  +61 (02) 9956 7300
F:  +61 (02) 9956 7411


Level 10, 1 Pacific Highway, North Sydney, NSW 2060

 
http://www.tt.com.au


--
Disclaimer: This email is confidential and may contain privileged information for the sole use of the person or business to which it is addressed. If you are not the intended recipient, please notify the sender by return e-mail or phone as you must not view, disseminate, distribute or copy this email without our consent. We do not accept any liability in connection with any computer virus, data corruption, incompleteness, or unauthorised amendment of this email. It is the sole responsibility of the receiver to scan for viruses before opening.

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


Re: New Problem.

Posted by Kamal Bhatt <kb...@tt.com.au>.
Sorry, I should clarify myself:

informEdit.getChild("list_item_edit").setValue(selectedRow.getChild("list_item").getValue()); 


does not work. list_item and list_item_edit are boolean fields.

To confuse matters more,  I tried the following code:

selectedRow.getChild("list_item").setValue(true);
var list_item = selectedRow.getChild("list_item").getValue();
if (list_item == true) cocoon.log.error("hello");

and it turns out that true != true, because "hello" does not print.

I have even put debugging statements in BooleanField.java and it remains 
false.

What am I doing wrong?

Kamal Bhatt wrote:

>
> OK, this is fixed, I used getForm instead of looking up the field, 
> that seems to work.  Now I have another problem. I am trying to copy 
> the boolean field to/from the repeater, but it doesn't work.
>
> It is always set to false. I would prefer being able to set this like 
> the other values that way I could create a general function to copy 
> to/from a repeater row to/from a group of fields with the same names.
>
> Cheers.
>


-- 
Kamal Bhatt

Tourism Technology Pty Ltd


T:  +61 (02) 9956 7300
F:  +61 (02) 9956 7411


Level 10, 1 Pacific Highway, North Sydney, NSW 2060

 
http://www.tt.com.au


--
Disclaimer: This email is confidential and may contain privileged information for the sole use of the person or business to which it is addressed. If you are not the intended recipient, please notify the sender by return e-mail or phone as you must not view, disseminate, distribute or copy this email without our consent. We do not accept any liability in connection with any computer virus, data corruption, incompleteness, or unauthorised amendment of this email. It is the sole responsibility of the receiver to scan for viruses before opening.

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


New Problem.

Posted by Kamal Bhatt <kb...@tt.com.au>.
OK, this is fixed, I used getForm instead of looking up the field, that 
seems to work.  Now I have another problem. I am trying to copy the 
boolean field to/from the repeater, but it doesn't work.

It is always set to false. I would prefer being able to set this like 
the other values that way I could create a general function to copy 
to/from a repeater row to/from a group of fields with the same names.

Cheers.

-- 
Kamal Bhatt

Tourism Technology Pty Ltd


T:  +61 (02) 9956 7300
F:  +61 (02) 9956 7411


Level 10, 1 Pacific Highway, North Sydney, NSW 2060

 
http://www.tt.com.au


--
Disclaimer: This email is confidential and may contain privileged information for the sole use of the person or business to which it is addressed. If you are not the intended recipient, please notify the sender by return e-mail or phone as you must not view, disseminate, distribute or copy this email without our consent. We do not accept any liability in connection with any computer virus, data corruption, incompleteness, or unauthorised amendment of this email. It is the sole responsibility of the receiver to scan for viruses before opening.

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