You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need to validate some inputs with accessing to database. I did it using payload key. After unsuccesful validation need to return view with the same form ('profile' form) and information what is wrong to mark not valid form fields. In payload function i know which fileds are not valid, but don't know how to pass this to failAction and then. I hope You know what i mean. How to do that properly ?
In the validation function, instead of returning true for error, return a new Error(). You can set any properties you want on that error and those will show up in the onPreResponse function. I don't think you need failAction here.
Thank You for response.
I did as You said, but in onPreResponse function i get lost keys setted before. I did using Hapi.error (with and without error.reformat();), but custom key lost too. In the second approach message "survive". Something wrong with that ?
It is expecting the payload validation function to return an error compatible with joi. This means it is going to use the message and details properties only when creating a new error object internally. I can see how this can be very limiting for you use case. Let me see what I can do to pass along the original error from joi or custom code.
I need to validate some inputs with accessing to database. I did it using
payload
key. After unsuccesful validation need to return view with the same form ('profile' form) and information what is wrong to mark not valid form fields. Inpayload
function i know which fileds are not valid, but don't know how to pass this tofailAction
and then. I hope You know what i mean. How to do that properly ?By the way, idea of #1498 would be great.
The text was updated successfully, but these errors were encountered: