locked
Validation of text Fields in CRM form RRS feed

  • Question

  • Hi all,

    I have created few text type fields in CRM 2013 form of account entity, I want to validate the fields in below formats and restrict users to enter characters,special characters except below formats without showing any alert meassage on front or showng any customization on front end of CRM. How we can do it? using Javascript/Jquery or C# with regexpression . Please advise as I am new to CRM.

    textfield1:: format1: 12/456/4589 or format2: 124564589 (9digit)

    textfield2:: format1: 1235789654 (10digit)

    textfield3:: format1: 4545554844 (10digit)

    textfield4:: format1: 8798546566 (10 digit)

    textfield5:: format1: 45646456666666484998999 (20digit)

    textfield6:: format1: 8748456555 (10digit)

    textfield7:: format1: 132/457/7890 or format2: 12888888722 (10digit)

    Please advise.

    
    • Moved by DotNet Wang Thursday, April 28, 2016 8:31 AM
    Wednesday, April 27, 2016 8:28 AM

All replies

  • Hi maddyboss,

    >>I want to validate the fields in below formats and restrict users to enter characters,special characters except below formats without showing any alert meassage on front or showng any customization on front end of CRM. How we can do it? using Javascript/Jquery or C# with regexpression

    This forum is about the .net framework C# programming language, IDE, libraries, samples, and tools, as your issue is more related to the CRM development, we help you move it to the CRM development forum for better support.

    For my best help you, if you want to validate the text with your expected format, I think you’d better use below regular expression to restrict them. About using JQUERY, I think you could try using onkeyup event to achieve it. For further things about the usage of JQuery on asp.net web page, you could post them in ASP.NET Forums for better support.

    textfield1:  (^\d{9}$)|(^\d{2}\/\d{3}\/\d{4}$)
    textfield7:  (^\d{10}$)|(^\d{3}\/\d{3}\/\d{4}$)
    textfield2-textfield4, textfield6:  (^\d{10}$)
    textfield5:  (^\d{20}$)

    Thank you for your understanding.

    Best Regards,

    Albert Zhang


    Thursday, April 28, 2016 8:11 AM
  • Hi,

    We can achieve this using JavaScript,

     1. Use Regex to validate formats

     2. Add an event to onchange of field or on save of the form as per your requirement

     3. Use SetNotification/ XRM OOB alert/ Js Alert to notify user.


    Ramanathan Rajendran MCTS - Dynamics CRM

    Saturday, May 7, 2016 5:06 PM
  • You can write a java script on change of the text field in which you can use regex expression to validate the string entered in the text field as per your required format. You can allow only numbers and “/” for the field using regex expression. If your condition doesn’t satisfy then you can make text field as blank. 


    Dynamics CRM MVP | Inogic | http://inogic.blogspot.com| news at inogic dot com

    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

    Monday, May 9, 2016 1:11 PM