I am using the packaged seaside version that comes with VW 7.7. Not updated to latest, because I ran into issues getting the latest out of the cincom public repository. <div>I do have the latest version loaded into pharo and it uses JSJoin for the data option in JQAjax so the java variabels will still be treated as a String.</div>
<div><br></div><div>Using a dictionary for the dataparams is a way to fix this, but I understand your concerns with multiple keys of the same value. I haven't figured that one out yet :) maybe using a Dictionary which allows double keys?</div>
<div><div><br></div><div><br><div><div><br><div class="gmail_quote">2010/8/15 Lukas Renggli <span dir="ltr"><<a href="mailto:renggli@gmail.com">renggli@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Are you using all the latest code? There were quite a few changes in<br>
that area recently.<br>
<br>
I doubt that using a dictionary generally works, because the<br>
serialization methods return multiple string parameters.<br>
<br>
Lukas<br>
<br>
On 15 August 2010 18:44, Bart Veenstra <<a href="mailto:bart.veenstra@gmail.com">bart.veenstra@gmail.com</a>> wrote:<br>
> Hello there fellow smalltalkers.<br>
> I am using JQuery alot and some plugins rely on the jquery data to be<br>
> processed as a dictionary instead of a query string generated by JSJoin when<br>
> using a POST request.<br>
> By default the data object in JQAjax is serialized like this:<br>
><br>
> bind("move_node.jstree", function(e, data) {<br>
> data.rslt.o.each(function(i) {<br>
> $.ajax({<br>
> type: "POST",<br>
> data: ["event=move_node.jstree", "performcopy=" +<br>
> <a href="http://data.rslt.cy" target="_blank">data.rslt.cy</a>, "id=" + $(this).attr("id"), "metadata=" +<br>
> JSON.stringify($(this).data("jstree")), "ref_id=" + data.rslt.np.attr("id"),<br>
> "ref_metadata=" + JSON.stringify(data.rslt.np.data("jstree")), "position=" +<br>
> data.rslt.cp + i, "title=" + <a href="http://data.rslt.name" target="_blank">data.rslt.name</a>, "_s=eOxqO8i-5PB3xS69",<br>
> "_k=ep5WPiUeiuB5Jw_L", "5"].join("&"),<br>
> url: "/questionmanager"<br>
> })<br>
> })<br>
><br>
> Which results in a POST with the following params:<br>
><br>
> 5_kep5WPiUeiuB5Jw_L_seOxqO8i-5PB3xS69eventmove_node.jstreeidquestioncategory_3metadata{"path":"sandmin/questioncategories/questioncategory_3","id":3}performcopyundefinedposition50ref_idquestioncategoriesref_metadata{"path":"sandmin/questioncategories","id":"questioncategories1"}titleundefined<br>
><br>
> Some values are not correctly translated by javascript because everything is<br>
> presumed a String.<br>
> In this example the concatination of position goes wrong because when<br>
> position=" + data.rslt.cp + i<br>
> is executed, the variabels data.rslt.cp and i are concatinated as a string<br>
> because the whole thing is a string. So the data does not arrive in the way<br>
> I want at the server.<br>
> To fix this issue I made some changes to the data method in JQAjax:<br>
> from:<br>
> JQAjax data<br>
> ^self options at: 'data' ifAbsentPut: [JSJoin new]<br>
> to:<br>
> JQAjax data<br>
> ^self options at: 'data'<br>
> ifAbsentPut:<br>
> [| type |<br>
> type := self options at: 'type' ifAbsentPut: ['GET'].<br>
> type = 'POST' ifTrue: [GRSmallDictionary new] ifFalse: [JSJoin new]].<br>
> GRSmallDictionary does not understand some methods used by the rest of<br>
> seaside, so I added them as well:<br>
> GRSmallDictionary add: anAssociation<br>
> anAssociation isVariableBinding<br>
> ifTrue: [self at: anAssociation key put: anAssociation value]<br>
> ifFalse: [self at: anAssociation put: ''].<br>
> ^anAssociation<br>
><br>
> GRSmallDictionary addAll: aCollection<br>
> aCollection _addAllToDictionary: self.<br>
> ^aCollection<br>
> GRSmallDictionary collection<br>
> ^self<br>
><br>
> This results in the correct serialization of post requests:<br>
> bind("move_node.jstree", function(e, data) {<br>
> data.rslt.o.each(function(i) {<br>
> $.ajax({<br>
> type: "POST",<br>
> data: {<br>
> event: "move_node.jstree",<br>
> performcopy: <a href="http://data.rslt.cy" target="_blank">data.rslt.cy</a>,<br>
> id: $(this).attr("id"),<br>
> metadata: JSON.stringify($(this).data("jstree")),<br>
> "ref_id": data.rslt.np.attr("id"),<br>
> "ref_metadata":<br>
> JSON.stringify(data.rslt.np.data("jstree")),<br>
> position: data.rslt.cp + i,<br>
> title: <a href="http://data.rslt.name" target="_blank">data.rslt.name</a>,<br>
> "_s": "Ww1O92fPwzOMnyHw",<br>
> "_k": "nThH6d1dgDERL5ax",<br>
> "5": null<br>
> },<br>
> url: "/questionmanager"<br>
> })<br>
> })<br>
> with the request post parameters:<br>
> 5_kzGF3nB7vsPFGzplS_s2H-w22qrPABNE-Fleventmove_node.jstreeidquestioncategory_4metadata{"path":"sandmin/questioncategories/questioncategory_4","id":4}position6ref_idquestioncategoriesref_metadata{"path":"sandmin/questioncategories","id":"questioncategories1"}<br>
> the position is now calculated correctly.<br>
> I don't know where to go from here :) Atleast it works in my Visual Works<br>
> 7.7 image, But I am unfamiliar with pharo to commit this change.<br>
> Is this something Seaside could use?<br>
> And how can i control the serialization of the dictionary keys. Sometimes<br>
> the are encapsulated by double quotes, and sometimes the aren't :S.<br>
> Regards,<br>
> Bart Veenstra<br>
><br>
><br>
><br>
><br>
><br>
> _______________________________________________<br>
> seaside mailing list<br>
> <a href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a><br>
> <a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
><br>
><br>
<font color="#888888"><br>
<br>
<br>
--<br>
Lukas Renggli<br>
<a href="http://www.lukas-renggli.ch" target="_blank">www.lukas-renggli.ch</a><br>
_______________________________________________<br>
seaside mailing list<br>
<a href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a><br>
<a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
</font></blockquote></div><br></div></div></div></div>