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

  • SEARCH
  • Home
  • 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 7618519
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:25:29+00:00 2026-05-31T03:25:29+00:00

Currently i have a field that takes in a telephone number. It performs a

  • 0

Currently i have a field that takes in a telephone number.

It performs a length validation without fail. What i really want is there to be length validation only when a value is input, and no validation when there is no value. How can i accomplish this?

<p:inputText id="corporateTel" label="#{labelResource.telephone}">
    <f:validateLength minimum="5" maximum="20" />
</p:inputText>
  • 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-31T03:25:30+00:00Added an answer on May 31, 2026 at 3:25 am

    This is already the default behaviour. Your problem is caused elsewhere. Perhaps you used an int instead of Integer or String, so that it defaults to 0 instead of null. Or perhaps you used an Integer while running the webapp on Tomcat/JBoss wherein the default Apache EL implementation would implicitly coerce it to 0 instead of null. You can turn it off by adding the following VM argument:

    -Dorg.apache.el.COERCE_TO_ZERO=false
    

    Or use String instead of Integer. This is also a more appropriate data type for phone numbers as they may have a leading 0 which would otherwise be chopped off when using Integer.

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

Sidebar

Related Questions

I currently have a select-case that will read a name field from a recordset,
I have a table that has an AUTO_INCREMENT field. Currently, it is also a
I currently have a SQL query that returns a number of fields. I need
I currently have an advanced search page that searches a number of fields in
I currently have an asp.net page, that takes in the data from this view
I currently have this code which reads the first field in a database record
I currently have my code set to disable the submit button when the field
Say I have a table with a unique positive integer field. I currently have
I have a table in MySQL 4.0 which currently has a year field as
I have a table of users with a field birthday (DATE). Currently, I select

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.