Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6182921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T01:16:46+00:00 2026-05-24T01:16:46+00:00

Using the Play! Framework, I have a field that requires the user to enter

  • 0

Using the Play! Framework, I have a field that requires the user to enter a numeric value greater than zero. In my controller, I have something like this:

public static void save(@Min(value = 1, message = "Age must be greater than zero") int age) {
     ...
}

This works as expected and the error message is shown if the user enters in zero or less. However, if the user enters in something like abc then the message shown on the screen says Incorrect value.

What do I have to do to make the UI show a more user friendly error message in this situation?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T01:16:47+00:00Added an answer on May 24, 2026 at 1:16 am

    You can try to use a regular Expression that checks if the parameter is numeric.

    public static void save( @Match(value = "[0-9]+", message="Age must be numeric")
                             @Min(value = 1, message="Age must be greater than zero") int age ) {
        ...
    }
    

    A workaround may also be to override the message for incorrect values.

    Put this in your messages file.

    validation.invalid=%s must be numeric
    

    However this will change the message for the whole application and may not always be appropriate.

    Another possible solution is to clear the validations and then invoke all validations you want in your save-Method:

    public static void save( int age ) {
        validation.clear();
        validation.min(age, 1);
        ...
    }
    

    This will clear all validations that have been done automatically. Then you can invoke the validations yourself.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the AVAudioPlayer framework, and I have several sounds that play one
iam using AVFoundation Framework to play mp3 file ,everything works great ، i have
I have the following Play Framework entity (using Morphia for persistence) as part of
Using TortoiseSVN against VisualSVN I delete a source file that I should not have
I am using the MediaPlayer framework to play a movie on the iPhone. There
I have made a multiplayer game using the GameKit Framework where 2 iPhones/iPods can
I have been using the encryption class of codeigniter (PHP framework) for a while
I have started to play with xVal as my validation framework for an ASP.Net
I am using C# and Microsoft.Xna.Framework.Audio ; I have managed to record some audio
I am using the following template tag in the Play framework to create an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.