Tip:
You can dynamically populate a validation pattern or script message with a value from a data source. This allows you to ensure users enter the correct value in the field.
To make the field read only and display a data value that is calculated and displayed through an attached script, select Calculated – Read Only. Users cannot edit the calculated value.
To make the field editable and display a data value that is calculated and displayed through an attached script, select Calculated – User Can Override. Users can edit the value if the calculation script has been written to accept the input. If a user does edit the calculated value, the custom message you specify in the Override Message box appears.
See also 

To control how a barcode obtains data