Data Validation

Certified Senior Developer

Hey,

I am creating a service request management application. In that I'm creating a form for the user to fill and submit to raise the requests.

Now while submitting the status of the request would be pending and it would be assigned to respective groups of people who would either accept / reject the request.

Next while the status is pending, I'm allowing the user to change the details of the request which he / she had raised, so that mistakes in the request if any could be rectified by the user.

Now I want to create a validation for it. The validation is, if the user clicks on edit and submits the form without changing any contents of the request, I should show an error message saying "Something needs to be changed in order to submit".

Is there any solution to this, as in any way in which I could do this?  

   

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    You will need to do check if user has made any changes. What you can do is when user clicks on Edit button, store the cdt (assuming you are storing all the form data in a cdt) into a local variable say oldCDT. Next when user makes any changes the changes will reflect on the rule input cdt not the local one.

    Create another local variable say differences, that will check and store difference between cdts- local!oldCDT and ri!recordCDT. you can make use of cdtdifference() or you can create expression to compare values per field basis of cdt as well. The local!differences if blank, signifies user didnt do any changes, but if changes are done it will store some data e.g. field that were modifed with or without new and old data as per your need.

    So, if user clicks on Submit, you can check if local!differences is empty or not and based on that you can validate. You can actually use shwowhen to disable or enable submit button as well while displaying the message to modify something.

    Hope this helps!

    Note: cdtDifference() is available in a plugin CDT Diff Utilities.

  • 0
    Certified Senior Developer
    in reply to Harsha Sharma

    Thank you, I'll definitely try this method

Reply Children
No Data