Advertisement
enyo

Untitled

May 17th, 2012
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. json = { "errors":{"name":["is too long (maximum is 50 characters)"], "organization":["can't be blank"] ,"on":["name", "organization"]} }
  2.  
  3.  
  4. formattedErrors = [ ]
  5. # Go through the fields in "on"
  6. for name in json.errors.on
  7.   # Alert each error in the different sections
  8.   formattedErrors.push "#{name}: #{json.errors[name].join ', '}"
  9. alert "Following errors were encountered: " + formattedErrors.join("\n")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement