Multi-value fields on the Web

OK, I’m trying to do something a little tricking. I have a table on a notes form with fields M1,T1,W1,H1,and F1. They are computed fields, Multi-value, Comma separted, displayed with NewLine. I have hidden the entire table from the web.

Below the HIDDEN table is a section that generates the HMTL for the table and explodes the multi-value fields into separate fields using the same name for each field.

Ex. <input name = "U1" type="text" value = "0.00">

<input name = "U1" type="text" value = "5.00">

<input name = "U1" type="text" value = "8.00">

(Notice the input name is the same as the computed field in Notes)

My issue is that when I change the values of one of the U1 fields on the web, it isn’t saved in Notes.

Any help would be much appreciated!!

Subject: RE: Multi-value fields on the Web

Yeah – you’re not going to be able to do it that way. Domino doesn’t assume that multiple text fields with the same name are intended as multivalue fields.

You could create a hidden multivalue field and generate the HTML for that, and then use JavaScript to copy its value into some editable fields as the form is loaded. On submit, use LS to copy the values back to the hidden feld.

Subject: Multi-value fields on the Web

What is the formula for M1,T1, etc fields? Is U1 one of the computed fields that are hidden?

Subject: Multi-value fields on the Web

My guess is that you are experiencing what’s described here:Reply - CodeStore

You can either use nested tables as Jake points out to force your fields to be posted grouped together, or you need to write a javascript function that will be called before you submit that will store each fields data into a “catch all” field.

For example, you would have these fields defined on your form as type=‘hidden’

M1_all

T1_all

W1_all

H1_all

F1_all

your onsubmit would call a function like this for each of your fields.

concat(“M1”,“M1_all”);

concat(“T1”,“T1_all”);

concat(“W1”,“W1_all”);

concat(“H1”,“H1_all”);

concat(“F1”,“F1_all”);

where the concat function is:

function concat(sSourceId, sTargetId) {

var oSource = document.getElementsByName(sSourceId)

var sValues = "";



// loop thru all the source fields and combine the data into one text string

// separate data with a new line.

for (i=0; i < oSource.length; i++) {

	sValues = sValues + oSource[i].value + "\r\n";

}



// take your concatenated string of values and store in your target field

document.getElementById(sTargetId).value = sValues	

}

Your computed field that builds the table could then be:

sHTML := “”;

@For(n := 1;

n <= @Elements(M1_all);

n := n + 1;

sHTML := sHTML + "

");

sHTML

Subject: RE: Multi-value fields on the Web

Great post! That was a huge help. Thanks!

Drew

http://www.qtsconsulting.com