You are viewing this page out of context. To see it in the context it is intended please click here.
About This Page
Reply posted by Jake Howlett on Fri 6 Jul 2001 in response to Storing lots of input fields in one list
The problem and the solution
Ok, I've done a bit of investigating and here is what I learnt - using this [<ahref="http://www.ethereal.com/">handy little tool</a>]. The first thing I did
was look at what was being sent back to the server when you create two columns
of fields as you described. Here is the TCP Packet information:
[<br clear="all" /><code style="color:006600;">]
POST /development/jakeh/personal.nsf/multival?OpenForm&Seq=1 HTTP/1.0
Referer: http: //uk-n5uata-04/development/jakeh/personal.nsf/multival
Accept-Language: en-gb
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 4.0)
Host: uk-n5uata-04
Content-Length: 333
Connection: Keep-Alive
Pragma: no-cache
__Click=ff0b821a3629605b80256a80006ca325%2F%24Body%2F0.8C8&Col1Values=1first&Col
2Values=
&Col1Values=&Col2Values=2second&Col1Values=1third&Col2Values=&Col1Values=
&Col2Values=&Col1Values=&Col2Values=&Col1Values=&Col2Values=2sixth&Col1Values=
&Col2Values=&Col1Values= &Col2Values=&Col1Values=
&Col2Values=&Col1Values=1last&Col2Values=2last
[</code>]
The bottom section show that the field names ("Col1Values" & "Col2Values") and
values are being sent as alternatin pairs for each column as the form is
collated left to right and top to bottom. The next thing I did was replace the
two columns with one field called "MultiValField". I made this a Checkbox and
then a Multi-Select keyword list. On both occasions the post was as below:
[<code style="color:006600;">]
POST /development/jakeh/personal.nsf/multival?OpenForm&Seq=1 HTTP/1.0
Referer: http: //uk-n5uata-04/development/jakeh/personal.nsf/multival
Accept-Language: en-gb
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 4.0; HSBC Asset
Management)
Host: uk-n5uata-04
Content-Length: 122
Connection: Keep-Alive
__Click=7293d43d9cd32c7880256a81003218e5%2F%24Body%2F0.196&MultiValField=2&
MultiValField=3&MultiValField=5&MultiValField=7
[</code>]
This is how I imagine that Domino expects the data for multi value fields to be
formatted - one after the other. This is the format that is rendered when we
have only one column on the form hence why the idea works.
The problem is that when we format the columns in a table the browser sends the
data from each column of each row one at a time. Domino then stops processing
values for a field if it encounters a field with a different name. If it then
comes across the same field later on it starts to interpret the values from
fresh.
[<b>Solution:</b>]
The trick here is that we need to layout our form in such a way that each field
gets sent all in one go. The easiest way I found of doing this for the two
column problem was to put each column in a new table. So all we need is a one
row/two column table. In the first cell add a one column table with as many
rows as you need and then another one column table in the second cell with the
same number of rows. Add the fields to these tables. Now, when the browser
submits the form it goes through each table and cell one by one. The fact that
the cell contains a sub table means that this gets processed before the cell
containing the second column.
We could also do away with the sub table and place the column in each cell by
seperating the fields with a <br> tag.
Hope all this helps,
Jake
-CodeStore