Methods of making a coating composition including a film-forming material having a covalently bonded phosphorous atom, the phosphorous atom having at least one covalently bonded oxygen atom. Coating compositions can be used to coat a substrate, such as a metal substrate, by electrodeposition. Applied coatings containing the film-forming resins can be cured to form crosslinked films on substrates.