In Confiforms I have a number of fields for which I want to apply the same validation rule(s). I don't want these permanently part of the Field Definition macro for each field, as I want to be able to turn the validation on or off based on the value of a checkbox.
I am able to do this using a 'Confiforms Rules for Field Definition' macro, with a 'Validation rule' action, and listing all the fields I want to apply it to.
This seems to be working, and displays the error message on Save.
However, I would like the error message to include the name of the field that triggers the validation error. (I'm OK if it displays 10 error messages if there are 10 fields that fail validation, but I would like each error message to include the name of the affected field.)
Is there a way to do this?
Generally the idea is to set specific validation for each field you need and this allows you to show unique error messages specific to these validation rules
If you put the field names into the validation rule (first parameter on the macro), as comma separated list and when validation gets applied you will see these fields marked/highlighted with "red" border
This is what is possible at the moment.
Otherwise split your validation rules into different ConfiForms Field Definition Rules macros with unique validation rules and error messages
Yes, I have done that with several rules (one rule per field) ... but in this case I want to apply the same rule to a large number of fields.
I forgot about the highlighting in red, and that works fine for this case!
(It would be a slight problem if there might be multiple validation errors that each applied to multiple fields ... as it would be unclear to the user which error message applied to which highlighted fields. But I think I can avoid that by writing the validation rules carefully.)
Thanks again, Alex! As always, this is a brilliant plug-in, and you support it well!
Oh, another place something like this would be useful is in a universal rule to replace one value with another.
E.g. if I want a rule that detects when a user changes a field value to Foo, and change it to Bar ... and then apply that rule to 15 different fields ... then I have to create 15 separate rules, one for each field.
Why to create 15 separate rules if can have a rule that sets multiple fields at a time?
https://wiki.vertuna.com/display/CONFIFORMS/ConfiForms+Field+Definition+Rules#ConfiFormsFieldDefinitionRules-Setvalue can set multiple fields without any problem
field1=some value&field2=another value&field3=1
Phew, Atlassian Team 2021 blew by. With dozens of demos and a handful of keynotes, you may have missed some of the awesome Confluence Cloud sessions. Don't' worry, you can watch them all here or on Y...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events