cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to do case-insensitive Asynchronous Validation

satheeshkumar
Champ in-the-making
Champ in-the-making
Hi,
I have made Asynchronous validation in few of my fields as shown below,

{
   name : "alfresco/forms/controls/TextBox",
   config : {
      fieldId : "PRODUCT_NAME",
      label : "Product Name",
      name : "prop_cm_name",
      description : "Provide a Unique Value for the Product Name.",
      requirementConfig : {
         initialValue : true
      },
      validationConfig : [ {
         validation : "validateUnique", //This doesn't do case-insensitive validation
         itemsProperty : "response.productNameList",
         errorMessage : "The Product Name already exists!",
         publishTopic : "ALF_CRUD_GET_ALL",
         publishPayload : {
            url : "retrieve-library-list?retrieve=Product%20Library"
         }
      } ]
   }
}


But the above code reports an error
"The Product Name already exists"
only when I type the exact case as it is returned by the Json Array, sample JSON Response shown below,
{
  "productNameList": [
    {
      "prop_cm_name": "Banner Small"
    },
    {
      "prop_cm_name": "Business Vertical"
    },
    {
      "prop_cm_name": "Banner Medium"
    },
    {
      "prop_cm_name": "Business Accessories"
    },
    {
      "prop_cm_name": "Banner Large"
    }
  ]
}


For example, if I type
"Banner Small"
, I'll get the error, but if I type
"banner small"
, I won't get the error.
Is it possible to do the validation without considering the case.

Thanks in Advance,
4 REPLIES 4

satheeshkumar
Champ in-the-making
Champ in-the-making
Hi,

Can someone help me to do this case-insensitive validation?

Thanks in Advance.

satheeshkumar
Champ in-the-making
Champ in-the-making
Can I get any help or suggestions on this please?

ddraper
World-Class Innovator
World-Class Innovator
There are a couple of options here…
1) You can extend alfresco/forms/controls/TextBox and provide your own validation function that is case-insensitive (using the "validateUnique" function as a starting point)
2) You can raise an issue on the Aikau GitHub project and hope that it gets addressed at some point in the future
3) You could implement a solution and raise this as a pull request

The solution would need to be that the "validateUnique" validator accepts an additional configuration attribute of "caseSensitive" which defaults to true (for backwards compatibility) and you could then configure that.


Regards,
Dave

Thanks Dave, for your response. That gives me some idea.  I'll try to implement any of your suggestions.