[Seaside] Dynamically changed lists and forms
Andres Fortier
andres at lifia.info.unlp.edu.ar
Mon Oct 6 17:37:03 UTC 2008
Hi list,
I have the following situation: the user starts with an
empty list, adds elements dynamically (using javascript) and the
submits the form and I need to gather the values entered by the user.
My first approach was something like:
html form
with:[
html select
id: 'path_points';
size: 6;
list: self points.
html button
value: 'Add Point';
bePush;
onClick: 'addPoint();'.
html submitButton
callback: [self addPath];
text: 'Add Path'.
].
where:
function addPoint() {
var parent = document.getElementById("path_points");
var latVal = document.getElementById("newPointLat").value;
var longVal = document.getElementById("newPointLong").value;
var point = latVal + "," + longVal;
var newOpt = document.createElement("option");
newOpt.text = point;
newOpt.value = point;
parent.options.add(newOpt);
}
the function works ok (at least I can see the elemnts being added to
the list). However when the #addPath message is called as the result
of submitting the form the collection of points is empty. Could
anybody tell me what am I doing wrong or what am I missing?
Thanks in advance,
Andrés
More information about the seaside
mailing list