How to restrict quotation marks for Confiform input field?

Jan Marte Bacayo October 1, 2024

I currently use the Validation Rule : ^[a-zA-Z0-9]*$

I need to restrict quotation marks for a particular field as it errors out when I try to upload it into JIRA Summary field.

 

How do I add quotation marks "" and Parenthesis () to the validation rule? Or any other special character that can be restricted?

 

1 answer

0 votes
Alex Medved _ConfiForms_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 1, 2024

When you map the field to your Jira field use the escapeJSON function to handle ANY character that may break your mapping

[entry.field_name.escapeJSON]

As not only the quotation can break it 

Jan Marte Bacayo October 1, 2024

should I still place the validation rules or no need if i place escapeJSON tag?

 

Alex Medved _ConfiForms_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 1, 2024

You are mapping this to Jira summary field, right? 

So, you do that in the JSON mapping 

Jan Marte Bacayo October 1, 2024

Yes so i've got a Summary input field in confiform and that gets translated to JIRA Title.

But the title doesn't allow quotation marks, thus I need to input restriction.

 

I currently placed restriction as validation rule so as not to allow submission, but it still allows quotation marks on submission. so I wanted to also add restriction to quotation marks

 

Alex Medved _ConfiForms_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 1, 2024

Cannot tell much about the regular expression, but was trying to help you to make the Jira mapping more robust and work eve if someone puts the quotation or anything else harmful in the field's value

Radek Dostál
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 1, 2024

No idea about confiforms, but as far as regular expressions go, quotation marks are not reserved characters.

Generally (depending on the regex implementation/type) brackets are and should be escaped. I have yet to see any other approach to escaping in regex than backslashes.

So to put this into example:

^[a-z]+([0-9])$

This will match a string that begins with at least one lowercase a-z character, followed by and ending with a single digit. Here the brackets are used for grouping purposes, because you could then get the digit by referring to the brackets, such as $1

 

^[a-z]+\([0-9]\)$

With the brackets escaped, this will match a string that begins with at least one lowercase a-z character, followed by (, followed by a single digit, followed by and ending with ).

 

The regex in this case is probably implementation of https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html which contains more details.

 

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events