Hey guys, Thats the point... data = $H(data); solves my problem.
Thanks and Greets from Colombia Luke On Apr 24, 3:39 am, "T.J. Crowder" <[EMAIL PROTECTED]> wrote: > Hi Luke, > > I think you'll find if you use a debugger like Firebug that you're > actually getting an error: "each is not a function". evalJSON returns > an object, but each() is a method of Enumerables like Array and Hash. > > I'm pretty sure if you add this line after the eval: > > data = $H(data); > > ...it'll start working for you, because that creates a Hash. > Details:http://www.prototypejs.org/api/utility/dollar-h > > Hope this helps, > -- > T.J. Crowder > tj / crowder software / com > > On Apr 23, 11:29 pm, Luke The Duke <[EMAIL PROTECTED]> wrote: > > > Hi all > > > Iam new to Prototype and I have the following question: > > > A PHP Script (Zend Framwork) returns the following JSON Code after > > submitting a Form: > > > {"from_firstName":{"isEmpty":"Value is empty, but a non-empty value is > > required"},"from_lastName":{"isEmpty":"Value is empty, but a non-empty > > value is required"},"from_email":{"isEmpty":"Value is empty, but a non- > > empty value is required"},"to_firstName":{"isEmpty":"Value is empty, > > but a non-empty value is required"},"to_lastName":{"isEmpty":"Value is > > empty, but a non-empty value is required"},"to_email": > > {"isEmpty":"Value is empty, but a non-empty value is required"}} > > > Now the idea is to draw a red border around all the formfields > > mentioned in the JSON Code like 'from_firstName', 'from_lastName' etc. > > > So i thought I could proceed the data with evalJSON() to an object and > > than use the each() method. I tried the following code: > > > handleJSONResponse:function(transport) { > > var data = transport.responseText.evalJSON(true); > > data.each(function(s) { > > alert(s); > > }); > > > } > > > but nothing happens.. no error, nothing. I can > > alert(transport.responseText) which returns me the JSON Code above. > > But each() doesnt return me anything. > > > What do I do wrong? > > > Thanks for your help! > > > Luke The Duke --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---