Move validation logic from input() to rawElement()