cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dustin Jenkins <djenk...@invoqsystems.com>
Subject Re: CForms binding usage
Date Mon, 07 Mar 2005 22:33:12 GMT
Marc,

    Thanks very much for the response.  What I'm looking for is an 
alternative to manually calling the setters (and getters for populating 
the form object) of my business object for each Form field value.  
Imagine Hibernate for Form Object to Business Object relationships.  I 
don't want the from directly tied to the database even though the 
documentation show you can do just that.  It sounds like that's what the 
Form Binding gives me.

    So in review, I should be able to do the following:


Form Definition:

<fd:form
  xmlns:fd="http://apache.org/cocoon/forms/1.0#definition">


  <fd:widgets>

    <fd:field id="name">
      <fd:label>Bean Name:</fd:label>
      <fd:datatype base="string" />
      <fd:validation>
        <fd:length max="100" />
      </fd:validation>
    </fd:field>

  </fd:widgets>

</fd:form>


Java:

    public class MyBean {

        private String name;

        public void setName(String name) {
           this.name = name;
        }
     }


Flowscript:

    var myBean = new MyBean();
    var myForm = new Form("add-new-MyBean-form-template.xml");
    myForm.createBinding("add-new-MyBean-form-binding.xml");

    myForm.showForm("form-pipeline");

    myForm.save(myBean);


And have the myBean variable's name field populated, does that sound right?

Regards,
Dustin





Marc Portier wrote:

> Dustin,
>
> you should look at binding files as purely an alternative way to 
> describe the set of load and save actions that need to happen between 
> the internal cforms-widget-tree-model and your own business-entity model
>
> in the samples you will see how one can easily
>
> 1. interprete these binding files into actual 'binding instances' (to 
> be seen as little executable programs or data-transfering algorithms 
> in fact) by pulling them from the binding-manager (who builds those 
> from the xml description you write)
>
> (NOTE: if you use the flowcript API the binding-manager is hidden from 
> you, and the binding itself gets connected to the form at hand)
>
>
> 2. after that 'apply' these binding programms at your will to 
> load/save data from/to formmodel and objectmodel
>
> (NOTE: the flowscript API again will hide the fact that one binding 
> could be used on multiple forms, but that's because that opts for 
> making the most common case as easy as possible)
>
>
> Dustin Jenkins wrote:
>
>> I just read that it's its own file, sorry for not reading completely 
>> first.  So I guess my real question is how does one reference it?  Is 
>> it through the sitemap?
>>
>
> so no, it's your application logic (often in flowscript) that controls 
> when binding files are interpreted by the binding-manager and applied 
> to load-save data
>
>
> HTH,
> -marc=
>
>> Thanks again,
>> Dustin
>>
>>
>>
>> Dustin Jenkins wrote:
>>
>>> The documentation on the Cocoon site about Form Binding is loose 
>>> (http://cocoon.apache.org/2.1/userdocs/forms/binding.html).  Can 
>>> anyone tell me if the <fb: /> tags are supposed to go in the Form 
>>> Template file or does it have its own file seperate to the template 
>>> and definition files?  And if it does go into the Template file, 
>>> does the Definition file need to be edited to accomodate somehow.
>>>
>>> Many thanks,
>>> Dustin
>>>
>>> ---------------------------------------------------------------------
>>> 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


Mime
View raw message