Dynamically changed lists and forms

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Dynamically changed lists and forms

Andres Fortier-2
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
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Dynamically changed lists and forms

Lukas Renggli
>  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?

This is how HTTP/HTML works, not a restriction of Seaside: A
select-list is only a list of strings (and associated names) in the
web browser. Upon form submission the name of the selected item is
submitted to the server, not the items within the list itself.

I suggest that you have a look at Scriptaculous (or any other
Javascript framework). They provide built in functionality to push
values to the server and add them to a list on the server.

Cheers,
Lukas


--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Dynamically changed lists and forms

Andres Fortier-2
Thanks for the quick response Lukas. I thought that maybe I could
avoid submitting each value.

Cheers,
           Andrés

Lukas Renggli escribió:

>>  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?
>
> This is how HTTP/HTML works, not a restriction of Seaside: A
> select-list is only a list of strings (and associated names) in the
> web browser. Upon form submission the name of the selected item is
> submitted to the server, not the items within the list itself.
>
> I suggest that you have a look at Scriptaculous (or any other
> Javascript framework). They provide built in functionality to push
> values to the server and add them to a list on the server.
>
> Cheers,
> Lukas
>
>
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Dynamically changed lists and forms

Dave Bauer-2
On Mon, Oct 6, 2008 at 2:26 PM, Andres Fortier
<[hidden email]> wrote:
> Thanks for the quick response Lukas. I thought that maybe I could avoid
> submitting each value.

Offhand, you can add the list entries to a hidden variable that will
be submitted when you submit the form.

Dave

>
> Cheers,
>           Andrés
>
> Lukas Renggli escribió:
>>>
>>>  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?
>>
>> This is how HTTP/HTML works, not a restriction of Seaside: A
>> select-list is only a list of strings (and associated names) in the
>> web browser. Upon form submission the name of the selected item is
>> submitted to the server, not the items within the list itself.
>>
>> I suggest that you have a look at Scriptaculous (or any other
>> Javascript framework). They provide built in functionality to push
>> values to the server and add them to a list on the server.
>>
>> Cheers,
>> Lukas
>>
>>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>



--
Dave Bauer
[hidden email]
http://www.solutiongrove.com
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Dynamically changed lists and forms

Andres Fortier-2
Thanks Dave I didn't thought about that one. I think I may go in that
direction.

Thanks!
Andrés

Dave Bauer escribió:

> On Mon, Oct 6, 2008 at 2:26 PM, Andres Fortier
> <[hidden email]> wrote:
>> Thanks for the quick response Lukas. I thought that maybe I could avoid
>> submitting each value.
>
> Offhand, you can add the list entries to a hidden variable that will
> be submitted when you submit the form.
>
> Dave
>
>> Cheers,
>>           Andrés
>>
>> Lukas Renggli escribió:
>>>>  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?
>>> This is how HTTP/HTML works, not a restriction of Seaside: A
>>> select-list is only a list of strings (and associated names) in the
>>> web browser. Upon form submission the name of the selected item is
>>> submitted to the server, not the items within the list itself.
>>>
>>> I suggest that you have a look at Scriptaculous (or any other
>>> Javascript framework). They provide built in functionality to push
>>> values to the server and add them to a list on the server.
>>>
>>> Cheers,
>>> Lukas
>>>
>>>
>> _______________________________________________
>> seaside mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>
>
>
>
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside