Capturing a returned value from Javascript

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

Capturing a returned value from Javascript

Rob Rothwell
Can anyone point me towards an Aida example capturing a returned value from a Javascript script if one exists? 

I am still trying to figure out how to capture the sort order after the user interacts with a sortable list created with WebElement>>beSortable.

I can't seem to leave this one alone, although I have a working application using check boxes and "move up," and "move down" buttons to move items up and down in a list.  It DOES have the advantage of moving multiple elements at once, but I have had requests for a dragable list...

After finding the following Javascript example:  http://www.patmullin.com/weblog/2007/01/05/sortable-list-example-with-scriptaculous-and-phpmysql/, I thought I could maybe create a method like WebElement>>sortedList, which would take the serialized list from a a sortable WebElement (using WebElement>>beSortable), and return it, as in

var listorder = Sortable.serialize('items_list');  (Javascript code)

This was my start at it, (although I have no idea what the CDATA stuff is for!):

WebElement>>sortedList
    | script |
    self registerId.
    self app ensureJsResourceForScriptaculous.
    self app ensureJavascriptForScriptaculousInHeader.
   
    script := '// <![CDATA[ Sortable.serialize(''', self id asString,''')    // ]]>'.
    self scriptAfter: script

I just don't know how to get the return value, which would be a string that I could parse, etc..., and write a nice method that would return a list of sorted WebElements...

Just wondering...I know you are all busy...!

Rob

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: Capturing a returned value from Javascript

Nicolas Petton

Le dimanche 01 juin 2008 à 22:13 -0400, Rob Rothwell a écrit :

> Can anyone point me towards an Aida example capturing a returned value
> from a Javascript script if one exists?  
>
> I am still trying to figure out how to capture the sort order after
> the user interacts with a sortable list created with
> WebElement>>beSortable.
>
> I can't seem to leave this one alone, although I have a working
> application using check boxes and "move up," and "move down" buttons
> to move items up and down in a list.  It DOES have the advantage of
> moving multiple elements at once, but I have had requests for a
> dragable list...
>
> After finding the following Javascript example:
> http://www.patmullin.com/weblog/2007/01/05/sortable-list-example-with-scriptaculous-and-phpmysql/, I thought I could maybe create a method like WebElement>>sortedList, which would take the serialized list from a a sortable WebElement (using WebElement>>beSortable), and return it, as in
>
> var listorder = Sortable.serialize('items_list');  (Javascript code)
>
> This was my start at it, (although I have no idea what the CDATA stuff
> is for!):
>
> WebElement>>sortedList
>     | script |
>     self registerId.
>     self app ensureJsResourceForScriptaculous.
>     self app ensureJavascriptForScriptaculousInHeader.
>    
>     script := '// <![CDATA[ Sortable.serialize(''', self id
> asString,''')    // ]]>'.
>     self scriptAfter: script
>
> I just don't know how to get the return value, which would be a string
> that I could parse, etc..., and write a nice method that would return
> a list of sorted WebElements...
>
> Just wondering...I know you are all busy...!
Sorry to be so late to answer you Rob.
The easier way would be to write it using #script: method and write it
in pure javascript, but it would be better IMHO to write a nice
ajaxified component :)

When I'll have some time, I'll give you an example of such component.

Nico
--
Nicolas Petton
http://nico.bioskop.fr
            ___
          ooooooo
         OOOOOOOOO
        |Smalltalk|
         OOOOOOOOO
          ooooooo
           \   /
            [|]
--------------------------------
Ma clé PGP est disponible ici :
http://nico.bioskop.fr/pgp-key.html

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida

signature.asc (204 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Capturing a returned value from Javascript

Rob Rothwell
On Thu, Jun 5, 2008 at 1:21 PM, Nicolas Petton <[hidden email]> wrote:
Sorry to be so late to answer you Rob.

No problem.  That's what you get with "free!"  (of course, in my opinion, you get to work with great people, too...)

The easier way would be to write it using #script: method and write it
in pure javascript, but it would be better IMHO to write a nice
ajaxified component :)

That would be good to understand when you use what tool.  I still don't get how the data gets back and forth between Aida and javascript, though!
 
When I'll have some time, I'll give you an example of such component.

Thank you.  Like everyone else, once I have an example, I can usually figure some stuff out, although I am still struggling with the css parts of Aida when I want to restyle things!

Rob
 


_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida