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