Allow blank page fields but not be null

Kelly Leavitt asked on September 20, 2024 13:56

How do I allow for blank page type fields but force them to not be null?

I have a compiled site that has a couple of custom page types. These pages types have have custom fields. The content was copied over from a Kentico 11 site. For all the old pages, blank varchar fiels were empty, but not null. Now, when creating new pages of this type, the blank fields are null in the table. This breaks a lot of background processing. How do I enforce emtpy page fields to be NOT NULL? Changing the SQL field type manually breaks the code that actually adds the page to Kentico with Cannot insert the value NULL into column 'Regulations', table 'LionKentico13.dbo.LION_Course'; column does not allow nulls. INSERT fails.The statement has been terminated.

Thanks, Kelly

Recent Answers


Juraj Ondrus answered on September 23, 2024 06:11

You need to add some dummy character to the field. Depending on the validation it could be some whitespace character or use some special character (#; $; ^ etc.) which meaning will be "blank" field - but the field will not be null.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.