Are you sure you're not using data validation? The red dotted lines around the box are when the data you input is not valid, which can be when you put the wrong type of data in a box (text in a number field, text in a date field, etc), or if your value does not fall within a specified parameter. If you simply have checked the box of "Cannot be blank," then this should not happen.
You mentioned that you are toggling the "required field" attribute. Are you doing this with code?