Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

FormCalc error messages after signing (and locking) form: cannot change properties (of locked fields)

Avatar

Level 1

I just switched some code from JS to FormCalc, mostly in regards to layout behaviour. My form consists of different sections, and has multiple digital signature fields which lock down part of the form, except for the last signature which locks the whole form. No issues with JS.

 

But with Formcalc, after the form is signed and fields are locked, I get FormCalc error messages because it can't affect locked fields (and they shouldn't be anyways).

 

E.g.:

I have fields with exit event in which is checked whether the field is empty/null or not, and if not the border is removed/hidden. There is additional validation making sure that the required fields are filled before one is able to sign the form. After those fields are locked through signing (readOnly I assume?), everytime I tab out of one of those fields the exit event still triggers and I get an error message stating the properties (ie. border.presence) of this field cannot be changed.

 

In addition, locked fields with events on layout:ready trigger the same error message (not able to change properties) everytime a layout change on the form occurs.

 

I get that events still need to trigger on locked fields, eg for calculations. Is there a way around those error messages? When I do the same thing in JS there are no error messages. I can always switch back to JS, but for one that would be annoying, and there are things easier done with FormCalc (eg. string operations), and I'm not really a programmer...

 

Thanks for any help and your time.

2 Replies

Avatar

Level 10

Hi there,

 

I am not sure how this affect the "access" property of a field, maybe you should verify if there's any difference in the "access" value of the fields once the form is locked.

If the value was "readOnly" and changes to another value, you could probably make an if statement to avoid executing the code in that case.

 

Otherwise, the best solution should probably removing the "calculation" property of the field once the form is being locked.

 

I hope this will help.

Avatar

Employee
Why did you change to FormCalc for layout behaviour? You should be able to do this in JS as well?