cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kamal Bhatt <kbh...@tt.com.au>
Subject row-action + on-action
Date Thu, 16 Feb 2006 00:03:21 GMT
Hi
We are using a cform to generate a complex form. Part of this form has a 
number of repeaters. There is now a requirement to have one of these 
repeaters orderable. The trouble is that I need to store the position 
and this means rewriting the position (unfortunately, this information 
is not displayed on screen).  This means that I need some javascript. 
This is the code:

<snip>
...
        <fd:row-action id="moveup_validity" command="move-up">
           <fd:label>^</fd:label>
           <fd:on-action>
             <fd:javascript>
                var curr_row = event.source;
            var repeater = widget.lookupWidget("../validity");
             
            repeater.setState(WidgetState.ACTIVE);
             
            var prev_row = repeater.getRow(repeater.getIndexOf(curr_row) 
- 1);

            var curr_row_pos = curr_row.getChild("position").value;
            var prev_row_pos = prev_row.getChild("position").value;
            prev_row.getChild("position").setValue(new 
java.lang.Integer(curr_row_pos));
            curr_row.getChild("position").setValue(new 
java.lang.Integer(prev_row_pos));
              <fd:javascript>
            </fd:on-action>
         </fd:row-action>

         <fd:row-action id="movedown_validity" command="move-down">
           <fd:label>v</fd:label>
           <fd:on-action>
             <javascript>
                var curr_row = event.source;
            var repeater = widget.lookupWidget("../validity");
             
            repeater.setState(WidgetState.ACTIVE);
             
            var next_row = repeater.getRow(repeater.getIndexOf(curr_row) 
+ 1);

            var curr_row_pos = curr_row.getChild("position").value;
            var next_row_pos = next_row.getChild("position").value;
            next_row.getChild("position").setValue(new 
java.lang.Integer(curr_row_pos));
            curr_row.getChild("position").setValue(new 
java.lang.Integer(next_row_pos));
             <javascript>
           </fd:on-action>
        </fd:row-action>  

        <fd:row-action id="moveup_validity" command="move-up">
           <fd:label>^</fd:label>
           <fd:on-action>
             <javascript>
                var curr_row = event.source;
                 var repeater = widget.lookupWidget("../validity");
             
                 repeater.setState(WidgetState.ACTIVE);
             
                var prev_row = 
repeater.getRow(repeater.getIndexOf(curr_row) - 1);

                var curr_row_pos = curr_row.getChild("position").value;
            var prev_row_pos = prev_row.getChild("position").value;
            prev_row.getChild("position").setValue(new 
java.lang.Integer(curr_row_pos));
            curr_row.getChild("position").setValue(new 
java.lang.Integer(prev_row_pos));
              <javascript>
            </fd:on-action>
         </fd:row-action>

         <fd:row-action id="movedown_validity" command="move-down">
           <fd:label>v</fd:label>
           <fd:on-action>
             <javascript>
                var curr_row = event.source;
            var repeater = widget.lookupWidget("../validity");
             
            repeater.setState(WidgetState.ACTIVE);
             
            var next_row = repeater.getRow(repeater.getIndexOf(curr_row) 
+ 1);

            var curr_row_pos = curr_row.getChild("position").value;
            var next_row_pos = next_row.getChild("position").value;
            next_row.getChild("position").setValue(new 
java.lang.Integer(curr_row_pos));
            curr_row.getChild("position").setValue(new 
java.lang.Integer(next_row_pos));
             <javascript>
           </fd:on-action>
        </fd:row-action>  
...

</snip>

Unfortunately, the inclusion of the javascript causes the error (I have 
tried it with fd:javascript as well).

239477 2006-02-16 10:18:58,309 [http-8080-Processor25] FATAL 
ojb.broker.core.PersistenceBrokerImpl.error():157  - Broker is still in 
PB-transaction, do automatic abort before close!
279603 2006-02-16 10:19:38,435 [http-8080-Processor24] ERROR 
sitemap.handled-errors.prepareErrorHandler():165  - 
"resource://org/apache/cocoon/forms/flow/javascript/Form.js", line 47: 
uncaught JavaScript exception:
at promotion 
(file:/opt/lenya/jakarta-tomcat-5.0.28/webapps/cms/lenya/pubs/ch/flow/promotionFlow.js, 
Line 13)
at Form (resource://org/apache/cocoon/forms/flow/javascript/Form.js, 
Line 47):
org.apache.avalon.framework.CascadingException: Could not parse form 
definition from 
file:/opt/lenya/jakarta-tomcat-5.0.28/webapps/cms/lenya/pubs/ch/cforms/promotion.xml
org.apache.avalon.framework.CascadingRuntimeException: 
"resource://org/apache/cocoon/forms/flow/javascript/Form.js", line 47: 
uncaught JavaScript exception:
at promotion 
(file:/opt/lenya/jakarta-tomcat-5.0.28/webapps/cms/lenya/pubs/ch/flow/promotionFlow.js, 
Line 13)
at Form (resource://org/apache/cocoon/forms/flow/javascript/Form.js, 
Line 47):
org.apache.avalon.framework.CascadingException: Could not parse form 
definition from 
file:/opt/lenya/jakarta-tomcat-5.0.28/webapps/cms/lenya/pubs/ch/cforms/promotion.xml
...

Any help would be appreciated.

Cheers.

Kamal.

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


Mime
View raw message