Is there a way to disable text field case insensitivity for uniqueness in ConfiForms?
Asked by Kathleen Janiszewski:

I have a problem with case insensitivity on text fields with \[unique\] validation. I'm trying to update "contractor" to "CONTRACTOR" in a text field, but ConfiForms apparently treats text the same whether it is upper or lower case, at least with the \[unique\] validation. Does anyone know a way to disable case insensitivity or (same thing) enable case sensitivity?


Answers:
author: Kathleen Janiszewski
body: Sorry. This was supposed to be a reply.


author: Alex Medved _ConfiForms_
body: Hi

ConfiForms rule to validate uniqueness can be set to be case insensitive

![Screenshot 2023-06-07 at 22.13.00.png](https://community.atlassian.com/t5/image/serverpage/image-id/261844i7F7F679CBED74492/image-size/large?v=v2&px=999 "Screenshot 2023-06-07 at 22.13.00.png")

Alex

comments: author: Kathleen Janiszewski
body: The opposite is occurring. This is my code:

```
 <p class="auto-cursor-target">
<ac:structured-macro ac:macro-id="5b7f96d6-fe99-4134-b81c-7fe44091517f" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">title</ac:parameter>
<ac:parameter ac:name="fieldLabel">Title</ac:parameter>
<ac:parameter ac:name="type">text</ac:parameter>
<ac:parameter ac:name="required">true</ac:parameter>
<ac:parameter ac:name="validation">[unique]</ac:parameter>
</ac:structured-macro>
</p>
```

I want it to be the default, CASE SENSITIVE. However, when I add "CONTRACTOR" from my ConfiForm registration, I get a validation error, because "contractor" is already being used as a title. The it gets rejected because it is NOT unique, which tells me that it's CASE INSENSITIVE.  

Thank you.

-Kathleen Janiszewski


author: Alex Medved _ConfiForms_
body: Have a look at the idea I have shared - using a different method (field definition rule type) to check the uniqueness...

I dont know how to "fix" yours, sorry

Alex


author: Kathleen Janiszewski
body: Alex,

I got rid of \[unique\] and added the field definition rule, and I got the same results: I couldn't add a user with the title of "TESTING" because there was already one with the tile of "testing" . Moreover, I couldn't change a user's title from "testing" to "TESTING". But I could change it from "testing" to "testing 1-2-3", then change it from "testing 1-2-3" to "TESTING".

I can provide screenshots if you'd like.

Kind regards,

-Kathleen


author: Alex Medved _ConfiForms_
body: Kathleen,

Please have a look at the following demo

<http://recordit.co/eavrigALMK>

Hope it helps

Alex


author: Kathleen Janiszewski
body: Alex,

Thank you for the video. I would record one if I could. Here are some screenshots in order:

1) Notice the Validate Uniqueness rule with Case Insensitive UNCHECKED:

![Validate Uniqueness of title.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/262164iE5ED5BDB3E950BDB/image-size/large?v=v2&px=999 "Validate Uniqueness of title.PNG")  
2) I change "TESTING":

![reverted to uppercase testing.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/262166i868CAF8070609AE5/image-size/large?v=v2&px=999 "reverted to uppercase testing.PNG")  
to "testing":  
![lowercase testing entered.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/262169i89D558593ED3544B/image-size/large?v=v2&px=999 "lowercase testing entered.PNG")

3) This runs the update.action REST API call, and returns the following error which I (really another colleague's code originally) put into an alert:

![Error on testing.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/262170i54816A5B99204D8E/image-size/large?v=v2&px=999 "Error on testing.PNG")  
Again, this works fine if I first change it to "testing 1-2-3" then to "testing".

Kind Regards,

-Kathleen


author: Alex Medved _ConfiForms_
body: Could it be that there is some other rule in the form that interferes?

Try recreating an example I have shared - does it work for you?

Alex


author: Kathleen Janiszewski
body: Alex,

I have not created anything that simple.

There are many rules, but not on the "title" field. Also, it's an update.action, so there's only 1 field changing. I checked my code. I never use "upper" or "lower" anywhere. Could it be that it only happens with the REST API?

Kind regards,

-Kathleen


author: Kathleen Janiszewski
body: Alex,

I tried it your way. In order to get the registration macro to work, I had to remove \[unique\] from the Form Field Definition, but keep the Rule for Form Field Definition on the "title" field. However, it STILL DOES NOT WORK with the REST API! I get the error I show above. I need it to work in ALL cases. How do I do that?

Kind Regards,

-Kathleen


author: Alex Medved _ConfiForms_
body: What macro you have that has that "message"? I afraid this has nothing to do with the method I shared... (something else is conflicting)

My solution/example works with UI and with REST API... there is no difference

Alex


author: Kathleen Janiszewski
body: Alex,

It works fine with the UI on the add. However, then I use the REST API within the IFTTT macro, and I get multiple results, both "TESTING" and "testing" on the filter.action. Since I must have a one-to-one correspondence, my code throws an error when the filter action returns mutliple results.

Thanks again.

-Kathleen


author: Alex Medved _ConfiForms_
body: Are you using the <https://wiki.vertuna.com/display/CONFIFORMS/ConfiForms+Server+REST+API+version+1#ConfiFormsServerRESTAPIversion1-UpdateConfiFormsFieldvaluebyfilter> API endpoint to update your field's value?

Alex


author: Kathleen Janiszewski
body: Alex,

Actually, we use version 0:  
<https://wiki.vertuna.com/display/CONFIFORMS/ConfiForms+Server+REST+API+version+0>  

However, my colleague came up with a solution that our customer is ok with. We're going to force upper case in that field. I already trim() it everywhere, so adding UPPER()/toUpperCase() should be pretty straightforward.

Thank you for your help!

-Kathleen


Tags: confiforms

confluence-server

server