You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Stefan Klein <sk...@zipi.fi.upm.es> on 2003/03/20 13:31:38 UTC

database forms

Hi all,

I am looking for the quickest way to write database forms. It is something
that I will be doing thousands of times, so the goal is to find some really
efficient way.

Ideally it would look something like:
<table>table name</table> - selects the table

<inputbox ref="field" />   - a simple input field bound to a  field in the
table

<listbox ref="field" values="table.field" entries="table.field"/>  - a
listbox bound to a field, entries defines the options visible to the user,
values defines what is internally stored in the field. obviously the table
would be the same (useful for foreign key entries)

<checkbox ...


The form would be populated automatically with the database values (the
current record being selected by a request parameter) and update the values
on submit.

What I've been pondering about for quite a while now is what would be the
best way to implement this in cocoon.

I looked into the "departments and employees"-tutorial delivered with
cocoon2, which is quite close to what I'd like, but still not it. For
example I don't like having to define listboxes and populate the form by
using separate esql-statements. What data to fill into the form should
already be specified in the form definition.
My first idea was to start from there and implement a logicsheet that would
allow me to define tags like the ones above.

Then I looked into xmlforms and liked them a lot. However:
1. I am still looking for a tag reference. Maybe someone can help out.
2. I am still not entirely sure how they might help me. Surely it would be
possible to write a JavaBean that accesses the database, but doing that
every time again is not the simplification I am looking for. Is there a way
to reference database fields directly from the forms?


Basically, I would be very grateful for any kind of hint you can offer on
how to use xmlforms for this or on other ways of accomplishing the task
(maybe there would even be ways to take the database description and
generate a form from it?). I am quite stuck for ideas, but it seems a
standard job so I am sure many people have already found sufficient ways to
do it.


Thanks in advance
Stefan




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


Re: database forms

Posted by Stefan Klein <sk...@zipi.fi.upm.es>.
Hi Thorsten,

thanks for your reply. I've been pondering about your mail for a little
while now. The xsl looks like a clever idea. A few things remain unclear to
me:

What way do you use to get the data out of the DB. SQL-Transformer?

What do you refer to by static and variable data?
static=the definition of the form (as in your XML example), variable=the
data from the DB?

How do you get the data back into the database? using actions, I suppose?

In your example you've only got textboxes. With listboxes (<select> in HTML)
it gets a bit trickier, since you'll have to get the possible values from a
different table first. Have you got an idea for that, too?
Maybing using XSP-ESQL?
Or using XSL to generate a query that you can send through the
SQLTransformer and the whole through another XSL in your style?
I'll be thinking about it and let you know when I come up with something.

Regards
Stefan

----- Original Message -----
From: "Scherler" <th...@wyona.org>
To: <co...@xml.apache.org>
Sent: Thursday, March 20, 2003 5:58 PM
Subject: Re: database forms


> Hi Stefan,
>
> I have to master the same task. I am working in a telephone marketing
> department and writing the call agent DBs. I will introduce the 3 tier
> modell and will have to get rid of my formulars (VBA).
> We have some static fields (which are always the same -> address &
> contact person) and some variable (we have different campaigns where the
> questions to ask will always be different)
>
> I thought about that:
> 1) select a db (pool) => campaign Example
> 2) get the static data with <xsl:template match="static"/>
> 3) get the variable data and put it in a different tag
> 4) use a transform to create a html form (including validation through
> JavaScript)
>
> to 4)   like that xslt:
>  <xsl:template match="input/*">
>         <input>
>             <xsl:attribute name="type"><xsl:value-of
> select="name()"/></xsl:attribute>
>             <!-- -->
>             <xsl:choose>
>                 <xsl:when test="normalize-space(text())!=''">
>                     <xsl:attribute name="value"><xsl:value-of
> select="normalize-space(text())"/></xsl:attribute>
>                 </xsl:when>
>             </xsl:choose>
>         </input>
>     </xsl:template>
>
> with this xml:
> <form action="http://www.google.com/search" name="f">
> <input>
> <hidden name="ie">UTF-8</hidden>
> <hidden name="oe">UTF-8</hidden>
> <hidden name="hl">eng</hidden>
> <text name="q" maxLength="256" size="55"/>
> <submit name="btnG">Google-Search</submit>
> </input>
> <script>document.f.q.focus();</script>
> </form>
>
> ...
>
> King regards
> Thorsten
>
> Stefan Klein wrote:
>
> >Hi all,
> >
> >I am looking for the quickest way to write database forms. It is
something
> >that I will be doing thousands of times, so the goal is to find some
really
> >efficient way.
> >
> >Ideally it would look something like:
> ><table>table name</table> - selects the table
> >
> ><inputbox ref="field" />   - a simple input field bound to a  field in
the
> >table
> >
> ><listbox ref="field" values="table.field" entries="table.field"/>  - a
> >listbox bound to a field, entries defines the options visible to the
user,
> >values defines what is internally stored in the field. obviously the
table
> >would be the same (useful for foreign key entries)
> >
> ><checkbox ...
> >
> >
> >The form would be populated automatically with the database values (the
> >current record being selected by a request parameter) and update the
values
> >on submit.
> >
> >What I've been pondering about for quite a while now is what would be the
> >best way to implement this in cocoon.
> >
> >I looked into the "departments and employees"-tutorial delivered with
> >cocoon2, which is quite close to what I'd like, but still not it. For
> >example I don't like having to define listboxes and populate the form by
> >using separate esql-statements. What data to fill into the form should
> >already be specified in the form definition.
> >My first idea was to start from there and implement a logicsheet that
would
> >allow me to define tags like the ones above.
> >
> >Then I looked into xmlforms and liked them a lot. However:
> >1. I am still looking for a tag reference. Maybe someone can help out.
> >2. I am still not entirely sure how they might help me. Surely it would
be
> >possible to write a JavaBean that accesses the database, but doing that
> >every time again is not the simplification I am looking for. Is there a
way
> >to reference database fields directly from the forms?
> >
> >
> >Basically, I would be very grateful for any kind of hint you can offer on
> >how to use xmlforms for this or on other ways of accomplishing the task
> >(maybe there would even be ways to take the database description and
> >generate a form from it?). I am quite stuck for ideas, but it seems a
> >standard job so I am sure many people have already found sufficient ways
to
> >do it.
> >
> >
> >Thanks in advance
> >Stefan
> >
> >
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> >For additional commands, e-mail: cocoon-users-help@xml.apache.org
> >
> >
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
>


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


Re: database forms

Posted by Scherler <th...@wyona.org>.
Hi Stefan,

I have to master the same task. I am working in a telephone marketing 
department and writing the call agent DBs. I will introduce the 3 tier 
modell and will have to get rid of my formulars (VBA).
We have some static fields (which are always the same -> address & 
contact person) and some variable (we have different campaigns where the 
questions to ask will always be different)

I thought about that:
1) select a db (pool) => campaign Example
2) get the static data with <xsl:template match="static"/>
3) get the variable data and put it in a different tag
4) use a transform to create a html form (including validation through 
JavaScript)

to 4)   like that xslt:
 <xsl:template match="input/*">
        <input>
            <xsl:attribute name="type"><xsl:value-of 
select="name()"/></xsl:attribute>
            <!-- -->
            <xsl:for-each select="@*">
                <xsl:attribute name="{name()}"><xsl:value-of 
select="."/></xsl:attribute>
            </xsl:for-each>
            <xsl:choose>
                <xsl:when test="normalize-space(text())!=''">
                    <xsl:attribute name="value"><xsl:value-of 
select="normalize-space(text())"/></xsl:attribute>
                </xsl:when>
            </xsl:choose>
        </input>
    </xsl:template>

with this xml:
<form action="http://www.google.com/search" name="f">
<input>
<hidden name="ie">UTF-8</hidden>
<hidden name="oe">UTF-8</hidden>
<hidden name="hl">eng</hidden>
<text name="q" maxLength="256" size="55"/>
<submit name="btnG">Google-Search</submit>
</input>
<script>document.f.q.focus();</script>
</form>

...

King regards
Thorsten

Stefan Klein wrote:

>Hi all,
>
>I am looking for the quickest way to write database forms. It is something
>that I will be doing thousands of times, so the goal is to find some really
>efficient way.
>
>Ideally it would look something like:
><table>table name</table> - selects the table
>
><inputbox ref="field" />   - a simple input field bound to a  field in the
>table
>
><listbox ref="field" values="table.field" entries="table.field"/>  - a
>listbox bound to a field, entries defines the options visible to the user,
>values defines what is internally stored in the field. obviously the table
>would be the same (useful for foreign key entries)
>
><checkbox ...
>
>
>The form would be populated automatically with the database values (the
>current record being selected by a request parameter) and update the values
>on submit.
>
>What I've been pondering about for quite a while now is what would be the
>best way to implement this in cocoon.
>
>I looked into the "departments and employees"-tutorial delivered with
>cocoon2, which is quite close to what I'd like, but still not it. For
>example I don't like having to define listboxes and populate the form by
>using separate esql-statements. What data to fill into the form should
>already be specified in the form definition.
>My first idea was to start from there and implement a logicsheet that would
>allow me to define tags like the ones above.
>
>Then I looked into xmlforms and liked them a lot. However:
>1. I am still looking for a tag reference. Maybe someone can help out.
>2. I am still not entirely sure how they might help me. Surely it would be
>possible to write a JavaBean that accesses the database, but doing that
>every time again is not the simplification I am looking for. Is there a way
>to reference database fields directly from the forms?
>
>
>Basically, I would be very grateful for any kind of hint you can offer on
>how to use xmlforms for this or on other ways of accomplishing the task
>(maybe there would even be ways to take the database description and
>generate a form from it?). I am quite stuck for ideas, but it seems a
>standard job so I am sure many people have already found sufficient ways to
>do it.
>
>
>Thanks in advance
>Stefan
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
>For additional commands, e-mail: cocoon-users-help@xml.apache.org
>
>
>  
>



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