Expand my Community achievements bar.

Lock Numeric Field

Avatar

Former Community Member

I have two numeric fields in a form, one is a debit field and the other is a credit field. The user can fill out either one but should not be able to fill them both, is there a way to lcok the debit field if the user enters values in the credit field and vice versa.

Many thanks for your help

2 Replies

Avatar

Level 7

You can use the 'access' function to make one read-only when the other is filled in.

So you could do something like (in formcalc):

if (credit.isNull == 0) then

     debit.access = "readOnly"

else debit.access = "open"

endif

and then do the same the other way around.

Avatar

Former Community Member

Thanks for the answer but I am using JavaScript rather than FormCalc for the form. I would also like to be able to stop the user entering a value in the Credit Field if they have already entered a value in the Debit Field rather than making it read only after they had entered another value.