cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylv...@apache.org>
Subject Re: CForms, databinding and databases
Date Tue, 15 Nov 2005 06:51:22 GMT
Omar Adobati wrote:
> Good morning all,
>
>   yeah, I'm still working on the employee sample... Now I think that
> I'm in a good point of the understanding.... but I miss something...
>
> In the file flow.js, into the do_edit_employee() function I can read this:
>
> // Fill the form with the Map returned by JDBI.
> // No binding file, no Java object, no nothing! Cool, isn't it?
> // This is possible because:
> // - both the JDBC ResultSet and the form widgets are represented as
> Maps and Lists
> // - form widgets and database columns have the same name.
>
> And I think cool, this really make all easy and faster... but after a
> second I was depressed! My db schema doesn't permit to me to have
> widgets and database columns to have the same names...
> Yes, because I'm using a DB that has, for example, a table called
> telephoneNumber.
>   

How's that a problem? <fd:field id="telephoneNumber"> works perfectly!

> This table has three fields ID, IDTYPE, and VALUE.
> ID identify the owner of the telephone number by his own id, IDTYPE
> identify the type of the telephone number (home or office by now) and
> VALUE is the telephone number...
>   

I had the same kind of application (a small helpdesk system) when I 
wrote this flowscript/jdbi stuff.

To use the automatic binding used in this sample, your form has to 
reflect the structure of your database, i.e. have a repeater to 
represent the list of phone numbers. You can then iterate on the rows of 
the repeater to read/write them from/to the database.

> Now, I suppose is clear where the matter is: I have two widgets for
> each of the telephone number I need (homeNumber abd officeNumber) but
> I cant mach them with the columns Fields name!!!
>
> How to solve it? Does anybody know?
>
> as usually, thanks in advice
>   

That should be "thanks for any advice", or "thanks in advance" :-)

Sylvain

-- 
Sylvain Wallez                        Anyware Technologies
http://people.apache.org/~sylvain     http://www.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


Mime
View raw message