Creating conditionally required input fields with visual feedback using DHTML, XHTML, and CSS
By Donovan Myers
Posted on Mar 16, 2007
Recently, I was asked by one of our clients to come up with a way to make one set of input fields required if a particular radio button was checked and another set of input fields if the other radio button was checked. That would be just a simple JavaScript form check, however we also wanted to use CSS to visually let the user know that the field had just become required by making the text bold as well as adding a red asterisk (*) to the beginning.