Hide specific Content Type from form dropdown

I have a list with multiple content types. It's been decided we don't need one of them anymore so I've set it to not to be visible on new button (as we don't want to delete it to preserve historical content). This does remove it from the new button on the list but the Content Type field on the form(s) still has it listed. How do I hide the specific content type from the content type selector on the form so users can't pick it?

I can remove options from a regular drop down, but it returns a null error reading dataSource if I try it with the ContentType field.
(tried both with the content type name as well as id)

I've also tried $(fd.field('ContentType').$el).find('option') to go through the options and maybe remove it from there but it doesn't find anything (length 0)

Any other methods I could try?

Dear @teddy0bear,
Please, try the following:

Value is Content Type ID:

No errors but doesn't work

Dear @teddy0bear,
Do you wrap it inside fd.spRendered()?

It should go like this on the form:


Yes, it is wrapped in the fd.spRendered section. I tried with the content type I'm trying to remove as well as one of the still active ones and neither of them disappeared.

Hello @teddy0bear,

Please wrap the code inside the ready event like this:

    fd.field('ContentType').ready().then(() => {

It works! Thank you both!

1 Like