Hi,
I’m working on an MVC website with Kentico.
I have multiples pages with a certain page type but now I need to add an optional CTA field. Usually, I create a non mandatory bool field (ShowCTA), with 2 mandatory fields (Text and URL) whom are only visible if the CTA checkbox is checked.
The solution works well for new page types, but it doesn't for existing page types. The CI crashes because it tries to insert NULL in the mandatory columns.
The solutions I have so far Is to delete all the pages and recreate them, but it’s not really an option, especially since I have multiples environments.
My other solution is to uncheck the “required” checkbox and to add a condition in the view to verify if both fields are not empty, but it’s a bit weird from a user experience POV.
This is my ShowCTA field.
- Field name : ShowCTA
- Data type : Boolean
- Required : no
- Default value : no
- Form control : Check box
- Has depending field : yes
And both my fields look like this
- Field name : TextCTA
- Data type : Text
- Required : yes
- Default value : ""
- Form control : Text box
- Visibility condition: ShowCTA.Value == true
- Depends on another field : yes
Is there a way to keep the required fields without breaking the CI? Is it perhaps something fixed in later hotfixes (we are at version 12.0.46)?
Thanks in advance!