Add/Remove asterisk(*) for fields in default create/update action forms

Feature(s) impacted

Asterisk mark beside field names in default action forms

Observed behavior

As of now, the entity model defines allowNull attribute for all the columns of that entity.
If allowNull is true , FA action shows it as non-mandatory, because this can be left empty and database will support by setting null in that column.
But if allowNull is false , FA action shows it as a mandatory field where as per our use case we preset that column with a default value and don’t expect user to input that field.

Expected behavior

We wanted to know there exists some sort of custom setting where we can declare which fields should show asterisk mark and which all should not show irrespective of whether the column is mandatory or non-mandatory in database ?


  • Project name: Curator
  • Team name: Developers

You can allow the field to be null and add a default value when the database receive null value. After that, on the forestadmin app, you can enable the “read only” mode. It means the user can’t send a value.

An example:

I hope it will help you :slight_smile:

Thanks @Alban_Bertolini for the reply.
We wanted to have the field still editable and not read-only.
Actually, in the smart action there are fields that are custom handled in the controller even if the field is mandatory in database but from smart action we are allowing empty value and wanted same behavior in default create/update actions provided by FA so it would have been better to not show asterisk sign there.

I know that setting the allowNull property to true for those field would do the job but just checking if there is any other way to achieve this so that existing schema is not touched.

Have you tried to put the field as allowNull: true and add a validate attribute by adding custom validator ? FA checks the allowNull constraint to know if it should add the mandatory field, maybe a hack is to add a custom validator. I hope it will help you :pray: