How to process undefined input

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

How to process undefined input

Louis LaBrunda
Hi All,

I am being pushed to create a Seaside component that can process input fields
that haven't been defined in the form/component. The input fields will be
created by javascript when a button is clicked. It is expected that the server
will not be involved when this button is clicked. On the button click, a new row
of input fields will be created by the javascript in the web browser. The user
will enter data into these input fields. This process may be repeated, so many
new rows with new input fields may be added. Ultimately, a button or menu item
will be clicked and the data sent to the server. I need to catch this data and
save and deal with it.

I know this is not the normal way to obtain data but the tail is wagging the dog
here  . It would be nice if the elements of each row could be bound to an object
but I will take what I can get. Any ideas are welcome.

Lou
-----------------------------------------------------------
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:[hidden email] http://www.Keystone-Software.com

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

Re: How to process undefined input

Lukas Renggli
> I know this is not the normal way to obtain data but the tail is wagging the dog
> here  . It would be nice if the elements of each row could be bound to an object
> but I will take what I can get. Any ideas are welcome.

I would do it with an AJAX callback. The callback renders a new row of
input fields that are then added to the page. Like this you can
udirectly bind the form elements to your model as you would do with a
"static" form.

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: How to process undefined input

Sebastian Sastre-2
In reply to this post by Louis LaBrunda
Yes, as Lukas said. Using a bit of ajaxian requests you can achieve exactly
that.
Cheers,
Sebastian

> -----Mensaje original-----
> De: [hidden email]
> [mailto:[hidden email]] En nombre
> de Louis LaBrunda
> Enviado el: Tuesday, January 20, 2009 14:41
> Para: [hidden email]
> Asunto: [Seaside] How to process undefined input
>
> Hi All,
>
> I am being pushed to create a Seaside component that can
> process input fields
> that haven't been defined in the form/component. The input
> fields will be
> created by javascript when a button is clicked. It is
> expected that the server
> will not be involved when this button is clicked. On the
> button click, a new row
> of input fields will be created by the javascript in the web
> browser. The user
> will enter data into these input fields. This process may be
> repeated, so many
> new rows with new input fields may be added. Ultimately, a
> button or menu item
> will be clicked and the data sent to the server. I need to
> catch this data and
> save and deal with it.
>
> I know this is not the normal way to obtain data but the tail
> is wagging the dog
> here  . It would be nice if the elements of each row could be
> bound to an object
> but I will take what I can get. Any ideas are welcome.
>
> Lou
> -----------------------------------------------------------
> Louis LaBrunda
> Keystone Software Corp.
> SkypeMe callto://PhotonDemon
> mailto:[hidden email] http://www.Keystone-Software.com
>
> _______________________________________________
> 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
Reply | Threaded
Open this post in threaded view
|

Re: How to process undefined input

Louis LaBrunda
In reply to this post by Lukas Renggli
Hi Lukas,

Thanks for the reply.

>I would do it with an AJAX callback. The callback renders a new row of
>input fields that are then added to the page. Like this you can
>directly bind the form elements to your model as you would do with a
>"static" form.
>Cheers,
>Lukas

I am giving this a try but having a little trouble, if you could please
post some sample code it would be a big help.

Thanks, Lou
-----------------------------------------------------------
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:[hidden email] http://www.Keystone-Software.com

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

Re: Re: How to process undefined input

Rick Flower
On Wed, January 21, 2009 11:27 am, Louis LaBrunda wrote:

> I am giving this a try but having a little trouble, if you could please
> post some sample code it would be a big help.

Lou,

This is exactly one of the things I need to put in my web-app as well
in the coming months... I'll be using it for order entry where a user
can start out with a single row and use a select box for items and when
an item is selected it will auto-populate some other select boxes in
the same row and in the far right there will be a "add" button to add it
to the current order.. Once the user is done with all of their rows,
they can "save" their order which will send it over to the server...
I did something like this in PHP several years ago and it was very
messy and problematic with various versions of IE.. I just retired
the old code for this site last weekend thankfully.. I'm expecting the
Seaside version to work much better across the board.. Anyway, hopefully
Lukas might point us to some AJAX code that can point us in the right
direction.. (8->


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

Re: Re: How to process undefined input

Lukas Renggli
> the old code for this site last weekend thankfully.. I'm expecting the
> Seaside version to work much better across the board.. Anyway, hopefully
> Lukas might point us to some AJAX code that can point us in the right
> direction.. (8->

Have a look at SUUpdaterTest if you are using Scriptaculous, or at
JQAjaxFunctionalTest if you are using JQuery. Both tests demonstrate
how to add HTML to an existing page using an AJAX request . In your
case you probably want to replace the timestamp string with a block
that renders some traditional form fields. In any case use FireBug to
see the response of the AJAX request and how your favorite JavaScript
framework integrates it into the DOM.

Cheers,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside