Set Custom HTML in code?

Yes. See the bottom of

Setting a form’s html property may make more sense for an HTML Form than for other Form subtypes.