Set field as required conditionally using JS.