none
[URGENT] zipcode alphanumeric rules 10 characters RRS feed

  • Question

  • i need to set rules for zipcode which would accept both number and letters ,contains 10 characters.

    kindly help

    Example: A2B2C0D100


    Blitz





    • Edited by sree_23 Tuesday, November 5, 2019 5:44 AM
    Tuesday, November 5, 2019 5:36 AM

Answers

All replies

  • Hi,

    Just to confirm, is this a custom column you use in a list or library? If yes, do you have any other customization on this zip code column? 

    Please feel free to correct me if I have misunderstood and provide detailed information on your requirements.

    You can use Single line of text column which accepts both number and letters. Enter “10” under “Maximum number of characters” when you create the column and it will allow users to enter no more than 10 characters in the field.

    Best regards,

    Chelsea Wu


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Tuesday, November 5, 2019 6:39 AM
  • Yes i have created zipcode as single line of text and set the limit as 10 characters while column creation and we have already validation for zipcode in the infopath rule that it should validate zipcode accepting numbers only and now the requirement of zipcode should accept both letters and number since it should accept other country zipcodes as below example

    Zipcode: A2B2C0D100


    Blitz

    Tuesday, November 5, 2019 7:13 AM
  • Hi,

    If you want to change the former InfoPath form validation to accept both numbers and letters, you might have to delete the InfoPath rule as they cannot be achieved parallelly.

    You can use column validation via List settings > Columns > zip code > Column Validation.

    Here’s a sample formula for your reference:

    =AND(
             OR(ISNUMBER(0+[zip code]),ISTEXT([zip code])),
             ISERR(FIND("$",[zip code])),
             ISERR(FIND(".",[zip code])),
             ISERR(FIND(",",[zip code]))
             )

    You can also use custom code with Content Editor web part in the list to add column validation.

    Here are some more posts with similar request for your reference.

    Prevent special characters in list item.

    How to Validate a "Single Line of Text" field to allow only numbers, commas and spaces.

    https://social.msdn.microsoft.com/Forums/sharepoint/en-US/8e926fab-ffe2-43ee-bc63-4797e0fa38dd/how-to-validate-a-quotsingle-line-of-textquot-field-to-allow-only-numbers-commas-and-spaces?forum=sharepointdevelopmentprevious

    Best regards,

    Chelsea Wu


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    • Marked as answer by sree_23 Tuesday, November 5, 2019 9:56 AM
    Tuesday, November 5, 2019 7:58 AM
  • Thanks a lot.

    I am trying to run the rule separately for new section.In my new section infopath form i would need to validate zipcode  i should accept both letters and number since it should accept other country zipcodes as below example

    Zipcode: A2B2C0D100

    please let me know if we could set rules as below but the below accepts only numbers but i need to check for alphanumeric patterns

    • To add an InfoPath data validation condition with custom pattern: -?[0-9]*\.?[0-9]+
    • and specify that if the field "does not match this pattern", an error message should be displayed


    Blitz

    Tuesday, November 5, 2019 9:55 AM
  • Hi,

    How do you plan to use this custom pattern?

    As far as I know, it is not a valid formula accepted by InfoPath rule condition.

    Best regards,

    Chelsea Wu


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Thursday, November 7, 2019 9:52 AM
  •  

    Hi, 

    Thanks for marking my reply as the answer to this thread. I’m glad to know the information is helpful to you.

    Here I will provide a summary of this post for your information.

    [[URGENT] zipcode alphanumeric rules 10 characters - Summary]

    Expectation 
    ====================
    Set validation for a column to accept both number and letters, containing 10 characters

    Environment
    ====================
    SharePoint 2013

    Solution
    ====================
    You can create a single line of text column as the zip code column.

    Then set column validation for the zip code column via List settings > Columns > zip code > Column Validation.

    Here’s a sample formula for your reference:

    =AND(
               OR(ISNUMBER(0+[zip code]),ISTEXT([zip code])),
               ISERR(FIND("$",[zip code])),
               ISERR(FIND(".",[zip code])),
               ISERR(FIND(",",[zip code]))
               )

    Best regards,

    Chelsea Wu


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Friday, November 8, 2019 2:00 AM