You must insert a hidden field in the footer of the subform with the
nested_id set to the super_id.
So you have a valid value for the new generated sub field.
Hope that helps,
regards
Henner
Eg:
<db:dbform
autoUpdate="false"
followUp="/adressen/adressenEdit.jsp"
maxRows="1"
tableName="tadHauptadressen"
javascriptFieldsArray="true"
>
....
<db:dbform
autoUpdate="false"
followUp="/adressen/adressenEdit.jsp"
maxRows="*"
tableName="tadWeitereAdressen"
parentField="ID"
childField="ZADID"
orderBy="Name1"
>
db:footer>
<input type="hidden"
name ="ID"
value="<%=
currentRow_tadHauptadressen.get("ID") %>"
/>
<db:insertButton
caption="�bernehmen"
flavor="image"
src="_icons/save.gif"
showAlways="true"
/>
</td>
</tr>
</table>
</div></div>
</db:footer>
</db:dbform>
> -----Urspr�ngliche Nachricht-----
> Von: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Im
> Auftrag von Michael Stadler
> Gesendet: Samstag, 22. Februar 2003 01:23
> An: [EMAIL PROTECTED]
> Betreff: [dbforms] Nested Tables - PARENT/CHILD LINK
>
>
> Hi all,
>
> this topic has already been on the list in April 2002, but a
> succesful solution to it is not contained in the archives. If
> you help me get this solved, I promise to contribute an
> example covering this to the documentation!
>
> SCENARIO
> ========
>
> Consider two tables
>
> 1. SUPER_TABLE (attributes: SUPER_ID S1, S2)
> 2. NESTED_TABLE (attributes: NESTED_ID, N1, N2, SUPER_ID).
>
> SUPER_TABLE's primary key is SUPER_ID.
> NESTED_TABLE references SUPER_TABLE through the foreign key SUPER_ID.
>
> WHAT WORKS FINE
> ===============
>
> A nested dbform works well, with the subform using tag
> attributes parentField="SUPER_ID" and childField="SUPER_ID".
> I.e. it is possible to display nested editable lists as follows:
>
> SUPER_TABLE (limited to one row)
>
> +SUPER_ID+S1+S2+
> |1 |A1|A2|
> +--------+--+--+
>
> NESTED_TABLE (containing the rows with matching parentField /
> childField)
>
> +NESTED_ID+N1+N2+SUPER_ID+
> |1 |B1|B2|1 |
> |2 |B3|B4|1 |
> +---------+--+--+--------+
> | | | | <- Text Fields for Entering new Data
> +---------+--+--+ (SUPER_ID omitted because it shall be
> . taken from SUPER_TABLE's
> SUPER_ID field)
>
> WHAT DOES NOT WORK
> ==================
>
> However, when trying to insert a row using an insert button
> within the subform's footer, the following error message is displayed:
>
> "Make sure that field SUPER_ID is a KEY of the table
> NESTED_TABLE! Otherwise you can not use it as PARENT/CHILD
> LINK argument!"
>
> NAIVE, NO CLUE DEBUGGING
> ========================
>
> Looking into the code (DbFormTag.java from 1.1.3pr1, starting
> with line
> 2330) that some kind of validity check fails, but from
> debugging output I can see that actual_value for text field
> SUPER_ID is allright, whereas the value returned from the
> hashtable is NULL causing the exception.
>
> PREVIOUSLY PROPOSED SOLUTION
> ============================
>
> What was proposed earlier but didn't work then as it does not
> work now:
>
> "Declare SUPER_ID as a key for NESTED_TABLE in file dforms-config.xml"
>
> AND ITS RESULT
> ==============
>
> The only result is the database server having a fit about
> select statements with undefinded values, since there is
> still this NULL value...
>
> WHY I NEED A SIMPLE SOLUTION
> ============================
>
> I am a researcher without in-depth jsp or java knowledge and
> I am in desperate need of dbforms for getting a public
> environmental database up and running (see
> http://www.leda-traitbase.org). Fortunately > for me, your
> community puts a lot of efforts into a tool finally allowing
> non-programmers to build their jsp forms for database access.
>
> WHAT I THINK OF DBFORMS
> =======================
>
> Great tool, but not yet well documented! Perhaps I can help
> out a little by contributing an example or two...
>
> Cheers
>
> -Michael Stadler-
>
> --
> +++ GMX - Mail, Messaging & more http://www.gmx.net +++
> Bitte l�cheln! Fotogalerie online mit GMX ohne eigene Homepage!
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: SlickEdit Inc. Develop an
> edge. The most comprehensive and flexible code editor you can
> use. Code faster. C/C++, C#, Java, HTML, XML, many more. FREE
> 30-Day Trial. www.slickedit.com/sourceforge
> _______________________________________________
> DbForms Mailing List
>
http://www.wap-force.net/dbforms
-------------------------------------------------------
This SF.net email is sponsored by: SlickEdit Inc. Develop an edge.
The most comprehensive and flexible code editor you can use.
Code faster. C/C++, C#, Java, HTML, XML, many more. FREE 30-Day Trial.
www.slickedit.com/sourceforge
_______________________________________________
DbForms Mailing List
http://www.wap-force.net/dbforms