Dynamically changed lists and forms

View: New views
5 Messages — Rating Filter:   Alert me  

Dynamically changed lists and forms

by Andres Fortier-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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
seaside@...
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

Re: Dynamically changed lists and forms

by Andres Fortier-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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
seaside@...
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

Re: Dynamically changed lists and forms

by Andres Fortier-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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
> <andres@...> 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
>> seaside@...
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>
>
>
>
_______________________________________________
seaside mailing list
seaside@...
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

Re: Dynamically changed lists and forms

by Lukas Renggli :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

>  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
seaside@...
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

Re: Dynamically changed lists and forms

by Dave Bauer-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, Oct 6, 2008 at 2:26 PM, Andres Fortier
<andres@...> 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
> seaside@...
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>



--
Dave Bauer
dave@...
http://www.solutiongrove.com
_______________________________________________
seaside mailing list
seaside@...
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
LightInTheBox - Buy quality products at wholesale price!