[Seaside] JQuery callbacks using POST with conditional statements

Bart Veenstra bart.veenstra at gmail.com
Sun Jul 25 16:39:57 UTC 2010


I am using Seaside 3.0 which is included in the VW7.7 image and am trying to
create a JQPlugin for jstree (http://www.jstree.com/demo).

I got the basic functionality working on the tree, but now I would like to
have the user create new nodes in the tree using hte context menu.

JSTree offers this functionality by binding a function to a create node

(php example)

.bind("create.jstree", function (e, data) {
"operation" : "create_node",
"id" : data.rslt.parent.attr("id").replace("node_",""),
"position" : data.rslt.position,
"title" : data.rslt.name,
"type" : data.rslt.obj.attr("rel")
function (r) {
if(r.status) {
$(data.rslt.obj).attr("id", "node_" + r.id);
else {

In this javascript example, the parameters are sent to the server using a
JQuery Post. The second function takes care of the result and does a
rollback if  the creation failed.

I want to have the the same functionality in seaside like this:

((html jQuery id: treeId) tree)
plugins: #('json_data' 'themes' 'ui' 'contextmenu' 'dnd');
getChildrenBlock: [:node | self getChildren: node];
theme: 'default';
types: self treeTypes;
animation: 0;
createBlock: [:node :position :title :type | ] onSuccess: [:node :s |
] onFail: [:ex :s | ]

The createBlock first argument holds the seaside translated objects from the
javascript call, the second should be executed when the first block executes
correctly and the third should be executed when the command failed. The
onSuccessBlock should also hold the newly created node and a script to do
something wiht the newly created node.

What is the best way to accomplish this using a post call instead of a get
call? I probably could get this running with a normal GET jquery callback,
but I am worried about the length of the get request when using proxies who
cut off long urls (this happens quite a lot unfortunatly)

I hope anyone could push me in the right direction.


Bart Veenstra
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20100725/23470232/attachment.htm

More information about the seaside mailing list