playframework - How to pass session values to different methods in play and slick? -


I have a recognized method in one of my playing form model objects:

  Def validateForm (form: form [forms.RegisterForm.registerFormData]). = {Val Name = form ("name") value.get Val test = TableQuery [UsersTable] .filter (. _ Name === name) .firstOption. Do Get.name if (test == something) {blah} else {blah}}}  

The actual implementation of the controller:

  Def Register Submit = DBAPN {root RS = & gt; RegisterForm.registerForm.bindFromRequest.fold (formWithErrors = & gt; {BadRequest (views.html.user.register (formWithErrors))}, formData = & gt; {Wall Valform = RegisterForm.validateForm (RegisterForm.registerForm.fill (formData) ) if (valForm.hasErrors) {BadRequest (views.html.user.register (valForm))} else {stuff}})}  

I can pass slick session validateForm method Are you At the moment I can not query for form validation because there is no session to use queries.

I know that some of these references do not look beautiful, but since this post they have been changed. / P>

Just a session request

  def validateForm (form: Form [ forms .RegisterForm.registerFormData]) (contained session :. session)  

a built-in conversion from Rs value for a smart session, which will be implemented


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -