formal dress code means that you can only wear certain clothes but they have to be smart like a suit and tie.

Formal dress code actually means;
For a man – Dinner Jacket and trousers, shirt, and bow tie, unless you have a family tartan, then a formal Scottish or Irish Kilt may be worn instead of a Dinner Jacket and trousers, underwear is optional.

For a woman – a formal Ball Gown, not just a nice dress.