You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Мария Григорьева <ma...@gmail.com> on 2008/08/04 19:38:56 UTC

how to pass params from flowscript to the widget

Variable in the flowscript: 

 

var composition_id = experiment.get("id_compositions");

 

And the widget:

 

<fd:field id="density" required="true">

                <fd:label>Density</fd:label>

                <fd:datatype base="decimal"/>

                <fd:on-value-changed>

                               <javascript>

                                               var value = this.value;

                               </javascript>

                </fd:on-value-changed>

  </fd:field>

 

I need to pass "composition_id" to the widget's on-value-changed.


Re: how to pass params from flowscript to the widget

Posted by Magsend <ma...@gmail.com>.
And how to execute function from the flowscript in the widget's tag?


Magsend wrote:
> Variable in the flowscript: var composition_id =
> experiment.get("id_compositions"); And the widget: <fd:field id="density"
> required="true"> <fd:label>Density</fd:label> <fd:datatype
> base="decimal"/> <fd:on-value-changed> <javascript> var value =
> this.value; </javascript> </fd:on-value-changed> </fd:field> I need to
> pass "composition_id" to the widget's on-value-changed.
-- 
View this message in context: http://www.nabble.com/how-to-pass-params-from-flowscript-to-the-widget-tp18816044p18816714.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.


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


AW: AW: how to pass params from flowscript to the widget

Posted by Christofer Dutz <ch...@c-ware.de>.
Hi,

Well I have to admit, that I use Java and JavaFlow wherever I can.
In order to use Java-Listeners, all you have to do is to create a Java Class implementing ValueChangedListener.
You then can reference this by a "<java src="class-name-with-full-path"/>" element. If you use Jetty and Tomcat inside Eclipse in Debug mode, you can even set Breakpoints in your classes, and you can debug your application as normal java application. I don't like JavaScript, I have to admit that. Therefore I like JavaFlow more, even if JavaFlow in 2.1.10 has some really annoying bugs you have to get used to (No try-catch-blocks inside finally blocks ... Forbidden usages of almost everything "static" ... even constants).


Regards, 
    Chris





-----Ursprüngliche Nachricht-----
Von: Magsend [mailto:magsend@gmail.com] 
Gesendet: Dienstag, 5. August 2008 14:00
An: users@cocoon.apache.org
Betreff: Re: AW: how to pass params from flowscript to the widget


Chris, thank you very much for support.

Could you please explain, how to process JAVA-file in the sitemap?

And I can't find the samples on this subject with Java.

Are you using Java or JavaScript for the form processing? What's better? 

Thank you!!!


Christofer Dutz-3 wrote:
> 
> Hi,
> 
>  
> 
> you can set Attributes on CForms Widgets or maybe Fields, I know that I
> use
> these a lot to pass additional Information from JavaFlow to the Form.
> 
>  
> 
> <fd:field id="density" required="true">
> 
>                 <fd:label>Density</fd:label>
> 
>                 <fd:datatype base="decimal"/>
> 
>                 <fd:attributes>
> 
>                                <fd:attribute name=" composition_id "
> value=":"/>
> 
>                 </fd:attributes>
> 
>   </fd:field>
> 
>  
> 
> Or from code 
> 
>  
> 
> <fd:field id="density" required="true">
> 
>                 <fd:label>Density</fd:label>
> 
>                 <fd:datatype base="decimal"/>
> 
>                 <fd:on-value-changed>
> 
>                                <java src="MyValueChangedListener"/>
> 
>                 </fd:on-value-changed>
> 
>   </fd:field>
> 
>  
> 
> public class MyValueChangedListener implements ValueChangedListener,
> Serviceable {
> 
>       protected ServiceManager manager;
> 
>  
> 
>       public void service(ServiceManager manager) throws ServiceException
> {
> 
>             this.manager = manager;
> 
>       }
> 
>  
> 
>       public void valueChanged(ValueChangedEvent event) {
> 
>             Widget sourceWidget = event.getSourceWidget();
> 
>                   // Get your composite id somehow :
> 
>             String compositeId = "";
> 
>             sourceWidget.setAttribute("composite_id", compositeId);
> 
>       }
> 
> }
> 
>  
> 
> Hope this helps
> 
>  
> 
> Chris
> 
>  
> 
>  
> 
>  
> 
>  
> 
> Von: Мария Григорьева [mailto:magsend@gmail.com] 
> Gesendet: Montag, 4. August 2008 19:39
> An: users@cocoon.apache.org
> Betreff: how to pass params from flowscript to the widget
> 
>  
> 
> Variable in the flowscript: 
> 
>  
> 
> var composition_id = experiment.get("id_compositions");
> 
>  
> 
> And the widget:
> 
>  
> 
> <fd:field id="density" required="true">
> 
>                 <fd:label>Density</fd:label>
> 
>                 <fd:datatype base="decimal"/>
> 
>                 <fd:on-value-changed>
> 
>                                <javascript>
> 
>                                                var value = this.value;
> 
>                                </javascript>
> 
>                 </fd:on-value-changed>
> 
>   </fd:field>
> 
>  
> 
> I need to pass "composition_id" to the widget's on-value-changed.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/how-to-pass-params-from-flowscript-to-the-widget-tp18816044p18829596.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.


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




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


Re: AW: how to pass params from flowscript to the widget

Posted by Magsend <ma...@gmail.com>.
Chris, thank you very much for support.

Could you please explain, how to process JAVA-file in the sitemap?

And I can't find the samples on this subject with Java.

Are you using Java or JavaScript for the form processing? What's better? 

Thank you!!!


Christofer Dutz-3 wrote:
> 
> Hi,
> 
>  
> 
> you can set Attributes on CForms Widgets or maybe Fields, I know that I
> use
> these a lot to pass additional Information from JavaFlow to the Form.
> 
>  
> 
> <fd:field id="density" required="true">
> 
>                 <fd:label>Density</fd:label>
> 
>                 <fd:datatype base="decimal"/>
> 
>                 <fd:attributes>
> 
>                                <fd:attribute name=" composition_id "
> value=":"/>
> 
>                 </fd:attributes>
> 
>   </fd:field>
> 
>  
> 
> Or from code 
> 
>  
> 
> <fd:field id="density" required="true">
> 
>                 <fd:label>Density</fd:label>
> 
>                 <fd:datatype base="decimal"/>
> 
>                 <fd:on-value-changed>
> 
>                                <java src="MyValueChangedListener"/>
> 
>                 </fd:on-value-changed>
> 
>   </fd:field>
> 
>  
> 
> public class MyValueChangedListener implements ValueChangedListener,
> Serviceable {
> 
>       protected ServiceManager manager;
> 
>  
> 
>       public void service(ServiceManager manager) throws ServiceException
> {
> 
>             this.manager = manager;
> 
>       }
> 
>  
> 
>       public void valueChanged(ValueChangedEvent event) {
> 
>             Widget sourceWidget = event.getSourceWidget();
> 
>                   // Get your composite id somehow :
> 
>             String compositeId = "";
> 
>             sourceWidget.setAttribute("composite_id", compositeId);
> 
>       }
> 
> }
> 
>  
> 
> Hope this helps
> 
>  
> 
> Chris
> 
>  
> 
>  
> 
>  
> 
>  
> 
> Von: Мария Григорьева [mailto:magsend@gmail.com] 
> Gesendet: Montag, 4. August 2008 19:39
> An: users@cocoon.apache.org
> Betreff: how to pass params from flowscript to the widget
> 
>  
> 
> Variable in the flowscript: 
> 
>  
> 
> var composition_id = experiment.get("id_compositions");
> 
>  
> 
> And the widget:
> 
>  
> 
> <fd:field id="density" required="true">
> 
>                 <fd:label>Density</fd:label>
> 
>                 <fd:datatype base="decimal"/>
> 
>                 <fd:on-value-changed>
> 
>                                <javascript>
> 
>                                                var value = this.value;
> 
>                                </javascript>
> 
>                 </fd:on-value-changed>
> 
>   </fd:field>
> 
>  
> 
> I need to pass "composition_id" to the widget's on-value-changed.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/how-to-pass-params-from-flowscript-to-the-widget-tp18816044p18829596.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.


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


AW: how to pass params from flowscript to the widget

Posted by Christofer Dutz <ch...@c-ware.de>.
Hi,

 

you can set Attributes on CForms Widgets or maybe Fields, I know that I use
these a lot to pass additional Information from JavaFlow to the Form.

 

<fd:field id="density" required="true">

                <fd:label>Density</fd:label>

                <fd:datatype base="decimal"/>

                <fd:attributes>

                               <fd:attribute name=" composition_id "
value=":"/>

                </fd:attributes>

  </fd:field>

 

Or from code 

 

<fd:field id="density" required="true">

                <fd:label>Density</fd:label>

                <fd:datatype base="decimal"/>

                <fd:on-value-changed>

                               <java src="MyValueChangedListener"/>

                </fd:on-value-changed>

  </fd:field>

 

public class MyValueChangedListener implements ValueChangedListener,
Serviceable {

      protected ServiceManager manager;

 

      public void service(ServiceManager manager) throws ServiceException {

            this.manager = manager;

      }

 

      public void valueChanged(ValueChangedEvent event) {

            Widget sourceWidget = event.getSourceWidget();

                  // Get your composite id somehow :

            String compositeId = "";

            sourceWidget.setAttribute("composite_id", compositeId);

      }

}

 

Hope this helps

 

Chris

 

 

 

 

Von: Мария Григорьева [mailto:magsend@gmail.com] 
Gesendet: Montag, 4. August 2008 19:39
An: users@cocoon.apache.org
Betreff: how to pass params from flowscript to the widget

 

Variable in the flowscript: 

 

var composition_id = experiment.get("id_compositions");

 

And the widget:

 

<fd:field id="density" required="true">

                <fd:label>Density</fd:label>

                <fd:datatype base="decimal"/>

                <fd:on-value-changed>

                               <javascript>

                                               var value = this.value;

                               </javascript>

                </fd:on-value-changed>

  </fd:field>

 

I need to pass "composition_id" to the widget's on-value-changed.