Re: [Proto-Scripty] Re: Passing the content of an array in a form

2009-12-22 Thread Frédéric
Le mardi 22 décembre 2009 05:11, joe t. a écrit :

 For most typical cases, JSON is easier, and more efficient. For one,
 by sending a Content-type header of application/json you can send an
 array down from the server, and Prototype automatically converts it
 into a JSON object you can utilize.

I'm switching to json, and you're right, it is much easier to handle!

-- 
   Frédéric

--

You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.




[Proto-Scripty] Re: Passing the content of an array in a form

2009-12-21 Thread joe t.
For most typical cases, JSON is easier, and more efficient. For one,
by sending a Content-type header of application/json you can send an
array down from the server, and Prototype automatically converts it
into a JSON object you can utilize.

Hope that's helpful. There are much better explanations in the API
documentation, and people here in the group who can articulate it much
better than i.
-joe t.


On Dec 21, 2:59 am, Frédéric f...@gbiloba.org wrote:
 On lundi 21 décembre 2009, joe t. wrote:

  i may be misunderstanding the problem you're describing, but typically
  when you submit an array of values with the same field name, you want
  to use [] on the end of the field name. It's possible IE is
  submitting the array in its object form, which the server is seeing as
  string [object] and sending back untouched. If the fields are in
  your HTML, they need an attribute like:
  input ... name=picts[] /
  or if the data is managed by your script, and passed in the
  Ajax.Request as part of the parameters option, you still need to wrap
  the name into a string:
  { parameters: { picts[] : picts ... } }

  Sorry if that's on the wrong track.

 Thanks for the explanation.

 I was wondering: a better solution is may be to use json? What do you
 sthink about?

 --
     Frédéric

--

You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.




[Proto-Scripty] Re: Passing the content of an array in a form

2009-12-20 Thread joe t.
i may be misunderstanding the problem you're describing, but typically
when you submit an array of values with the same field name, you want
to use [] on the end of the field name. It's possible IE is
submitting the array in its object form, which the server is seeing as
string [object] and sending back untouched. If the fields are in
your HTML, they need an attribute like:
input ... name=picts[] /
or if the data is managed by your script, and passed in the
Ajax.Request as part of the parameters option, you still need to wrap
the name into a string:
{ parameters: { picts[] : picts ... } }

Sorry if that's on the wrong track.
-joe t.


On Dec 20, 7:10 am, Frédéric f...@gbiloba.org wrote:
 Hi,

 I have a little problem. I want to give the content of an array to a new
 page through a form. The javascript code is:

     this._view.selectedPicts.setAttribute('value', picts);

 I retreive the content using mod_python:

     fields = util.FieldStorage(req)
     selectedPicts = fields['selectedPicts'].split(',')

 All works fine under Firefox and Safari/konqueror, but fails under IE8:

 Firefox:

 fields={'numAdherent': [Field('numAdherent', '20')], 'numEvenement':
 [Field('numEvenement', '2')], 'selectedPicts': [Field('selectedPicts',
 'P4052858.JPG,PB135158.JPG,photo20-08-03_DSC5719net_redimensionner.jpg,_DSC0222.jpg,p1010005.jpg')]}

 IE8:

 fields={'numAdherent': [Field('numAdherent', '20')], 'numEvenement':
 [Field('numEvenement', '2')], 'selectedPicts': [Field('selectedPicts',
 '[object]')]}

 The strange thing is if I log 'picts' before sending the form, it is
 correct, even under IE8!

     console.debug(OrderingController._submit(): picts= + picts);

 Firefox:

 2009-11-0 12:53:55,198::DEBUG::OrderingController._submit():
 picts=P4052858.JPG,PB135158.JPG,photo20-08-03_DSC5719net_redimensionner.jpg,_DSC0222.jpg,p1010005.jpg

 IE8:

 JOURNAL : 2009-11-0 12:55:10,67::DEBUG::OrderingController._submit():
 picts=P4052858.JPG,PB135158.JPG,photo20-08-03_DSC5719net_redimensionner.jpg,_DSC0222.jpg,p1010005.jpg

 So, why do I get the wrong string in my form field under IE8? What should I
 use instead of just 'picts'?

 Thanks,

 --
     Frédéric

--

You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.




Re: [Proto-Scripty] Re: Passing the content of an array in a form

2009-12-20 Thread Frédéric
On lundi 21 décembre 2009, joe t. wrote:

 i may be misunderstanding the problem you're describing, but typically
 when you submit an array of values with the same field name, you want
 to use [] on the end of the field name. It's possible IE is
 submitting the array in its object form, which the server is seeing as
 string [object] and sending back untouched. If the fields are in
 your HTML, they need an attribute like:
 input ... name=picts[] /
 or if the data is managed by your script, and passed in the
 Ajax.Request as part of the parameters option, you still need to wrap
 the name into a string:
 { parameters: { picts[] : picts ... } }
 
 Sorry if that's on the wrong track.

Thanks for the explanation.

I was wondering: a better solution is may be to use json? What do you 
sthink about?

-- 
Frédéric

--

You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.