required property according to w3c cannot be anything but true if it appears.

required==='sometimes' will never be a case, and how the required property works is that its existence as an attributes on the input element informs that the input element is required to be filled out