scala - Play framework- design suggestion for validation -


i need validate if newly added entity, part of model has been added. addition happen taking input user. believe standard way add constraints in form along lines of

.verifying( "already exists", <code check if entity exists> ) 

this lead globalerror entity exists. error message static "already exists". i'm looking for, though, tell user possible matches exist, globalerror incapable of doing.

should want not adding validator , allowing binding succeed? way, when

myform.fold{ entity returned success => <success code>, erroneousform =>  <failure code>} 

i can take success branch , check there if entity duplicate? if similarities exist can redirect user? feel shouldn't controller's job, , of design logic inside controller, should technically lie inside model itself. , model should tell controller wrong , 'type of w can first create new element , upon finding potential rongness' , controller can take appropriate action. shouldn't have contain code determine if there wrong.

can please suggest should way it?


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -