RE: [Phplib-users] Problem with automated hidden field adding in OOH forms
Brought to you by:
nhruby,
richardarcher
|
From: Taylor, S. <Ste...@uk...> - 2003-04-29 13:37:56
|
If a form element is repeated on the same form multiple times, then =
that
element is stored in a javascript array.
e.g.
document.MyForm.FieldName[i].value;
=20
You should make sure you set the hidden elements multiple property to =
true
("multiple"=3D>true. This then adds [] to the field name, which tells =
php to
create an array for the element values when the form is submitted.
In this case you would access the element from javascript as follows
document.MyForm.elements[ 'FieldName[]' ][i].value
And from php $FieldName[i]
=20
Regards,
=20
-Stewart.
-----Original Message-----
From: Benjamin Hoft [mailto:ho...@eu...]
Sent: 29 April 2003 10:16
To: php...@li...
Subject: [Phplib-users] Problem with automated hidden field adding in =
OOH
forms
I had a problem with the automated hidden fields adding when i add the =
same
hidden element several times.
=20
I did this because the value has changed several times.
=20
Then the hidden field was printed out several times (as often as I add =
it to
the form object)
=20
the problem lay=B4s in the add_element function
=20
when the name of the hidden object is added to the $this->hidden array =
which
will be used when $f->get_finish is called to print out all hidden =
fields.
=20
due to the multiple adding $his->hidden has the name of the hidden =
field
twice or more.
and due to this will be printed out several times.
=20
when I use an JS to get a value from this field an error accours...
=20
a simple in_array search if the hidden object name is in the =
$this->hidden
array and adding it only if it=B4s not in it
should be aware of this problem.
=20
=20
best regards Benjamin
=20
|