I can not get the error flash when handling validation failure

#1

Hi guys, I’m getting a problem with validation.
My code backend works however I can not get any flash session in view.
Thank you so much!

Code backend
Screenshot%20from%202018-03-20%2009-44-19

Code frontent
Screenshot%20from%202018-03-20%2010-13-05

0 Likes

#2

hi eden.hz10,
i can find out couple of issues in your code,
1)first the hasErrorFor() method you need to use attribute name not ‘error’ string ,ex hasErrorFor(‘version’)
2)The next one , as per slandered use fails method after rules and messages method
ex:-
rules()
messages()
fails()
3) please consider flashAll() option instead of error:errorMessages.message
ex:-
this.ctx.session.withErrors(errorMessages)
.flashAll();

0 Likes