Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Confusion on how validate model data
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Mike  
View profile  
 More options Oct 6 2012, 4:46 pm
From: Mike <mich...@fortitude-solutions.com>
Date: Sat, 6 Oct 2012 13:46:16 -0700 (PDT)
Local: Sat, Oct 6 2012 4:46 pm
Subject: [2.0-java] Confusion on how validate model data

Apologies in advance if this is in the manual and I missed it or if it is
somewhere in these forums.  I have searched around for a while now and I
still can't seem to find what I am looking for.

I am trying to use the Constraints.Required on a model.  I was expecting
these to be checked when I attempt to save the object but it appears my
assumption was incorrect as my app is happily writing nulls for required
columns.

I am not binding forms to the model, I am writing a web service and binding
the Json using play.libs.Json.fromJson(jsonData,MyBean.class);  The only
examples I see online are binding forms to models so I suspect that this
may be the part I am missing but I am not certain.  If I wanted to have it
validate on save, is that even possible and, if so, how?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
James Roper  
View profile  
 More options Oct 7 2012, 9:42 pm
From: James Roper <jrop...@gmail.com>
Date: Sun, 7 Oct 2012 18:42:05 -0700 (PDT)
Local: Sun, Oct 7 2012 9:42 pm
Subject: Re: [2.0-java] Confusion on how validate model data

The Constraints.Required is part of the form validation API, and hence only
works when validating forms.  However, you can easily tell the Form
validation to validate JSON, like so:

Form<MyBean> myForm.bind(jsonData);

Will give you the validated MyBean, or the errors.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mike  
View profile  
 More options Oct 27 2012, 6:11 pm
From: Mike <mich...@fortitude-solutions.com>
Date: Sat, 27 Oct 2012 15:11:13 -0700 (PDT)
Local: Sat, Oct 27 2012 6:11 pm
Subject: Re: [2.0-java] Confusion on how validate model data

Thank you, that was very helpful.  I ended up creating a validator for it
but I will do this in the future.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »