Smart action field not in readOnly anymore after change hook

Hi Forest,

I have some fields in readOnly . They do appear in readOnly when I open the form.

… however they are not anymore in readOnly once their value is changed by the change hook:

I would like them to stay in readOnly after their value changes.

What I do in the change hook is something like that:

fields["Montant déjà remboursé sur l'échéance"].value = 100

I fixed the issue by resetting the isReadOnly to true just before returning the field:

change:  {
   ...
   fields["Montant déjà remboursé sur l'échéance"].value = 100
   fields["Montant déjà remboursé sur l'échéance"].isReadOnly = true
   return fields

is it the right way to do ?

Hey @Guiguijo,

This is indeed a bug on our end. I’m opening a ticket in our issue tracker.

As a not-so-good workaround, the only thing I can propose is to re-override isReadOnly inside your change hooks if that’s blocking on your end.

Be sure you’ll be ping once this is fixed :raised_hands:

1 Like

Yes it’s what I did.

thanks

Hi @Guiguijo :wave: sorry for the late response.

The fix has been released now.
Can you confirm your issue is solved ?

Thank you for your patience.

1 Like

Hi @Arnaud_Moncel , I test that and I tell you

Hi,

I’m using the Forest Liana gem 7.0.1 with Rails 6.1.4 and I’m experiencing the same issue. Once I use a hook (I’m using a load hook) to change some property on the fields, the ready only fields loose their read only property.

Hi @sergior :wave: can you open a new thread please :pray: this one is closed now!
Thanks.