Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Validation rule to check number entered is greater than zero.

Shakir Islam March 17, 2019

Hi Atlassians,

I new to creating ConfiForm pages and was wondering how I can apply a validation rules to restrict the numbers that can be entered into a field. For instance,

I have an Age field (fieldname = myAge) and I want to ensure values under 0 cannot be entered. I tried adding validation rules to the field, such as the following:

myAge:>0

[entry.myAge]:>0

 

Neither have produced the correct results. Whether I enter a negative or positive value, the 'Message to show when validation fails' is shown. 

 

Thanks in advance. 

2 answers

1 vote
fbunting
Contributor
March 29, 2019

I think you want myAge:<0 ... this triggers the validation message when that condition is met.

And to be clear, this does not go in the "Validation rules" parameter for the myAge field itself.  That parameter only provides a very limited set of validation rules, and in this case can just verify that it is a number.

Instead, add a separate Confiforms Rules for Field Definition macro (I think formerly known as Confiforms Field Definition Rules), which lets you use the much more versatile Filters.  

Configure the macro as follows:

  • Field name: Leave blank (this triggers the validation on form submit)
  • Condition: Set to myAge:<0
  • Action to execute: Set to Validation rule
  • Message to show when validation rule matches: "My Age should be >= 0" (or whatever)
0 votes
Ismael Jimoh
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.
March 17, 2019

Hi @Shakir Islam 

 

I believe raising this directly with ConfiForm support would get you the most appropriate answer.

You can contact their support here: https://marketplace.atlassian.com/apps/1211860/confiforms-data-forms-workflows?hosting=server&tab=support

Regards.

Ismael Jimoh
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.
March 17, 2019

Going by this sample https://wiki.vertuna.com/plugins/servlet/mobile?contentId=3670269#content/view/3670269 which I believe is what you were following I will use 2 fields with the startdate replacement field’s value set to 1 and then the actual validation matching what is shown in the sample.

why 1? because you mentioned you font want zero included.

Why not enter the value directly?

I am not sure if it’s expected to take values directly hence parsing value for comparison via a field as per the linked sample.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events