toneee
2 years ago

Parse JSON returned in an error from a form

Posted 2 years ago by toneee

Hi,

I have implemented Quill in a form.

The form submits fine using Requests (extending FormRequests) for validation. If the form has an error (e.g. a field not filled in it returns back to the form with the old values added to the inputs. Apart from the quill editor entry which when submitted converts the input to JSON and submits it, so when the form errors it returns the JSON string to the blade template, rather than the formatted text.

Does anyone know how to parse this in the blade template or is there another way to do this to fix this error?

Submitted data returned to blade:

{"ops":[{"insert":"test description\n"}]}

Please sign in or create an account to participate in this conversation.