You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by roy huang <li...@hotmail.com> on 2004/04/01 12:05:14 UTC

[CForms]can I dynamic bind repeaters in js on form define?

In carselector_form.xml from Cocoon Forms samples :
   <fd:field id="make" required="true">
      <fd:label>Make:</fd:label>
      <fd:datatype base="string"/>
      <fd:selection-list src="cocoon:/cars" dynamic="true"/>
      <fd:on-value-changed>
        <javascript>
          java.lang.System.err.println("maker changed from " + event.oldValue + " to " + event.newValue);
          var value = event.source.value;
          var typewidget = event.source.parent.getWidget("type");
          if (value != null) {
            // Get the corresponding type list
            typewidget.setSelectionList("cocoon:/cars/" + value);
       ....


I use a repeater to show table to do the same thing like multi-value's selectionlist.Can I rebind only the repeater just like setSelectionList?
If it can't ,I can use XXX.addRow() to do the similar thing,but how can I get the value from a pipeline(like cocoon:/cars/)?

Roy Huang

Re: [CForms]can I dynamic bind repeaters in js on form define?

Posted by Joerg Heinicke <jo...@gmx.de>.
On 01.04.2004 12:05, roy huang wrote:

> In carselector_form.xml from Cocoon Forms samples :
>    <fd:field id="make" required="true">
>       <fd:label>Make:</fd:label>
>       <fd:datatype base="string"/>
>       <fd:selection-list src="cocoon:/cars" dynamic="true"/>
>       <fd:on-value-changed>
>         <javascript>
>           java.lang.System.err.println("maker changed from " + event.oldValue + " to " + event.newValue);
>           var value = event.source.value;
>           var typewidget = event.source.parent.getWidget("type");
>           if (value != null) {
>             // Get the corresponding type list
>             typewidget.setSelectionList("cocoon:/cars/" + value);
>        ....
> 
> 
> I use a repeater to show table to do the same thing like multi-value's selectionlist.Can I rebind only the repeater just like setSelectionList?
> If it can't ,I can use XXX.addRow() to do the similar thing,but how can I get the value from a pipeline(like cocoon:/cars/)?

I don't know if I understood your question correctly, but the default
way does nothing else then creating the binding in the script:

java\org\apache\cocoon\forms\flow\javascript\Form.js, handleForm():

    var bindingURI = cocoon.parameters["bindingURI"];
    if (bindingURI != null) {
        form.createBinding(bindingURI);
    }

samples\forms\flow\binding_example.js:

function form2bean(form) {
    var bean = new Packages.org.apache.cocoon.forms.samples.Form2Bean();

    // fill bean with some data
    ...

    form.load(bean);
    form.showForm("form2-display-pipeline");
    form.save(bean);

    cocoon.sendPage("form2bean-success-pipeline", {"form2bean": bean});
}

Joerg


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