You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Lionel Crine <cr...@4dconcept.fr> on 2005/05/03 10:21:19 UTC

[CForm] binding question

Hi,

I'd like to change my binding document according a field (selectionList) 
in my form.

How can I do that ?

Tnahs
Lionel

-- 
Lionel CRINE
Ingénieur Systèmes documentaires
Société : 4DConcept
22 rue Etienne de Jouy 78353 JOUY EN JOSAS
Tel : 01.34.58.70.70 Fax : 01.39.46.06.90


Re: [CForm] binding question

Posted by David Verdin <ve...@agrocampus-rennes.fr>.
To submit dynamically, there is the "submit-on-change" attribute. It is 
available for selection-lists.

The problem is to pass your field content to the sitemap to make it use 
a different binding file.

If you use the "cocoon.sendpage" function, you generate a new request 
which will be processed by the sitemap. You can simply use your field 
content as a request parameter (e.g. 
cocoon.sendpage(http://whatever.com?param="your-field-content") ).
This parameter can be used by a flowscript to define a new binding file, 
with the function :

var param = cocoon.request.getParameter("param");

Well, these are just answer elements.
Hope they are usefull... You still have to find out how to retrieve your 
field content to put it in the http request.

Cheers,

David

Lionel Crine wrote:

> I see but my problem is elsewhere : I need to load dynamically a 
> binding document according a parameter in my selection list.
>
>
> besides, I have another idea (easier) :
>
> I'll create a first forms with this list and will process dynamically 
> to the right form.
> By the way, How do I submit dynamically ?
> I'm using
>     
> "<fd:on-value-changed><javascript>?</javascript></fd:on-value-changed>"
> but I don't know the flowscript method to submit the document.
>
>
> Thanks
> Lionel
>
>
>
>
>
>
>
>
>
> David Verdin wrote:
>
>> You can embed it in your flowscript.
>> This is an untested javascript function which should do the trick 
>> (derived from the Cocoon samples) :
>>
>> function MyFunction(form) {
>>
>>     var baseName = cocoon.parameters["base"];
>>    var source = cocoon.parameters["documentURI"];
>>
>>    // parse the document to a DOM-tree
>>
>>    var document = loadDocument(source);
>>
>>    // bind the document data to the form
>>    form.load(document);
>>
>>    // show the form
>>    form.showForm(baseName+"-display-pipeline");
>>
>>    form.save(document);
>>   // get the whole set of form inputs
>>     var temp = form.getModel();
>>    // get the content of the form field you use to define your output 
>> document
>>    var OutputURI = temp.fieldIndicatingTheOutputURI;
>>    // Finally, save your data to the right document.
>>    saveDocument(document, OutputURI);
>>
>> //send whatever registration confirmation page you use.
>>    cocoon.sendPage("pipo.html");
>> }
>>
>> Something like this, I guess.
>>
>> Lionel Crine wrote:
>>
>>> Hi,
>>>
>>> I'd like to change my binding document according a field 
>>> (selectionList) in my form.
>>>
>>> How can I do that ?
>>>
>>> Tnahs
>>> Lionel
>>>
>>> ------------------------------------------------------------------------ 
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>
>------------------------------------------------------------------------
>
>---------------------------------------------------------------------
>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: [CForm] binding question

Posted by Sylvain Wallez <sy...@apache.org>.
Lionel Crine wrote:

> I see but my problem is elsewhere : I need to load dynamically a 
> binding document according a parameter in my selection list.
>
>
> besides, I have another idea (easier) :
>
> I'll create a first forms with this list and will process dynamically 
> to the right form.
> By the way, How do I submit dynamically ?
> I'm using
>     
> "<fd:on-value-changed><javascript>?</javascript></fd:on-value-changed>"
> but I don't know the flowscript method to submit the document.


What do you mean by "flowscript method to submit the document"?

As for the dynamic binding, you should have a look at the Form.js file 
that defines the "load" and "save" methods. It basically used the 
BindingManager to create a Binding from an URI and uses it to load and 
save the form, which is nothing but the top-level widget.

The same approach can be used to dynamically load or save parts of a 
form (i.e. a container widget other than the top-level form) in your 
on-value-changed.

Hope this helps,
Sylvain

-- 
Sylvain Wallez                        Anyware Technologies
http://apache.org/~sylvain            http://anyware-tech.com
Apache Software Foundation Member     Research & Technology Director


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


Re: [CForm] binding question

Posted by Lionel Crine <cr...@4dconcept.fr>.
I see but my problem is elsewhere : I need to load dynamically a binding 
document according a parameter in my selection list.


besides, I have another idea (easier) :

I'll create a first forms with this list and will process dynamically to 
the right form.
By the way, How do I submit dynamically ?
I'm using
     "<fd:on-value-changed><javascript>?</javascript></fd:on-value-changed>"
 but I don't know the flowscript method to submit the document.


Thanks
Lionel









David Verdin wrote:

> You can embed it in your flowscript.
> This is an untested javascript function which should do the trick 
> (derived from the Cocoon samples) :
>
> function MyFunction(form) {
>
>     var baseName = cocoon.parameters["base"];
>    var source = cocoon.parameters["documentURI"];
>
>    // parse the document to a DOM-tree
>
>    var document = loadDocument(source);
>
>    // bind the document data to the form
>    form.load(document);
>
>    // show the form
>    form.showForm(baseName+"-display-pipeline");
>
>    form.save(document);
>   // get the whole set of form inputs
>     var temp = form.getModel();
>    // get the content of the form field you use to define your output 
> document
>    var OutputURI = temp.fieldIndicatingTheOutputURI;
>    // Finally, save your data to the right document.
>    saveDocument(document, OutputURI);
>
> //send whatever registration confirmation page you use.
>    cocoon.sendPage("pipo.html");
> }
>
> Something like this, I guess.
>
> Lionel Crine wrote:
>
>> Hi,
>>
>> I'd like to change my binding document according a field 
>> (selectionList) in my form.
>>
>> How can I do that ?
>>
>> Tnahs
>> Lionel
>>
>> ------------------------------------------------------------------------
>>
>> ---------------------------------------------------------------------
>> 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
>

-- 
Lionel CRINE
Ingénieur Systèmes documentaires
Société : 4DConcept
22 rue Etienne de Jouy 78353 JOUY EN JOSAS
Tel : 01.34.58.70.70 Fax : 01.39.46.06.90


Re: [CForm] binding question

Posted by David Verdin <ve...@agrocampus-rennes.fr>.
You can embed it in your flowscript.
This is an untested javascript function which should do the trick 
(derived from the Cocoon samples) :

function MyFunction(form) {

     var baseName = cocoon.parameters["base"];
    var source = cocoon.parameters["documentURI"];

    // parse the document to a DOM-tree

    var document = loadDocument(source);

    // bind the document data to the form
    form.load(document);

    // show the form
    form.showForm(baseName+"-display-pipeline");

    form.save(document);
   // get the whole set of form inputs
     var temp = form.getModel();
    // get the content of the form field you use to define your output 
document
    var OutputURI = temp.fieldIndicatingTheOutputURI;
    // Finally, save your data to the right document.
    saveDocument(document, OutputURI);

//send whatever registration confirmation page you use.
    cocoon.sendPage("pipo.html");
}

Something like this, I guess.

Lionel Crine wrote:

> Hi,
>
> I'd like to change my binding document according a field 
> (selectionList) in my form.
>
> How can I do that ?
>
> Tnahs
> Lionel
>
>------------------------------------------------------------------------
>
>---------------------------------------------------------------------
>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