web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Options to perform Client Side/ Server Side validations on portal forms

(0) ShareShare
ReportReport
Posted on by 55,410 Moderator

Hi,

I have configured Customer Service portal and have some requirements to put client/ server validations and display error message when users submit the web form.

How can these be achieved?

For example,

1)  Show error 'Field not populated' if a particular field is not populated

2) Show error 'No records exists in Sub entity' if the child entity doesn't contains any records. 

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Emmaneul James Abraham Profile Picture
    727 on at

    Hello Ravi

    In Web form Step under Custom javascript you can use below jquery function to validate fields, like below.

    if (window.jQuery) { (function ($) { if (typeof (webFormClientValidate) != 'undefined') { var originalValidationFunction = webFormClientValidate; if (originalValidationFunction && typeof (originalValidationFunction) == "function") { webFormClientValidate = function () { originalValidationFunction.apply(this, arguments); if ( $("#new_number").val() != "") { EmptyValidationMessage(); $("#ValidationSummaryEntityFormView").html("Number Field is empty"); $("#new_number").focus(); $("html, body").animate({ scrollTop: 0 }, "slow"); return false; } //return false; // to prevent the form submit you need to return false // end custom validation. return true; }; } } }(window.jQuery)); } function EmptyValidationMessage() { $("#ValidationSummaryEntityFormView").empty(); $("#ValidationSummaryEntityFormView").show(); }

    Thanks 

    James

  • ashlega Profile Picture
    34,477 on at

    Hi Ravi,

     from the server validation standpoint.. What if you had a real-time workflow/plugin to do the validations? Would that error be displayed in the portal?

    (I have not tried, but I'm just curious to know.. will try later.. however, since the portal is talking to Dynamics "directly", I'm assuming such validations will kick in)

  • Verified answer
    Emmaneul James Abraham Profile Picture
    727 on at

    Hello Alex

    I guess Plugin / work flow validation errors will be shown as fatel Errors (generic error message with unique ID)  at portal end, it will be bit difficult to show proper validation error message if we go with this approach.

    Thanks

    James

     

  • ashlega Profile Picture
    34,477 on at

    Hi Emmaneul,

       you are correct. I just tried - it does display that error as a generic error message..

  • RaviKashyap Profile Picture
    55,410 Moderator on at

    Thanks Emmaneul,

    Will this only work for Web Form Step or can the same be used in Web Pages as well? I will try this.

    Any thoughts on achieving server side validations?

  • Parashuram  Profile Picture
    381 on at

    For server side validation, Web form or pages need to be integrated with sdk.

    I feel this will not possible by either javascript or Plugin/workflow.

  • RaviKashyap Profile Picture
    55,410 Moderator on at

    Thanks Parashuram.

    Could you share some details on how to integrate web form or pages with SDK?

  • Parashuram  Profile Picture
    381 on at

    Hi Ravi, I assume that u r developing portal forms in .net component then in the web solution add required sdk assemblies. Do server side operation like checking data in entity and all.Give appropriate message after validation.

    If u r doing it in adx portal or now it's the part of D 365, need to do R and D to me.

  • Verified answer
    Arpit Shrivastava Profile Picture
    7,518 User Group Leader on at

    Hi Ravi,

    If you want to perform Client Side Validations, you can refer my below article for the same :

    http://arpitmscrmhunt.blogspot.in/2017/01/client-side-validation-using-javascript.html

    If you want to put conditions based on current form fields then you can directly use Client side validations while If you want to perform validations based on some other entities data in that case you can use Synchronous Odata to fetch the result and then use the same validations as mentioned above.

    You do not have server side code handler in CRM Portal, though you can use Odata to fetch data and put conditions based on that.

    For use Odata in Adxstudio/CRM Portal - Refer my below article:

    http://arpitmscrmhunt.blogspot.in/2016/12/adxstudio-portal-how-to-use-odata.html

    Cheers

  • RaviKashyap Profile Picture
    55,410 Moderator on at

    Thanks Arpit.  Will try these options.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans