I used the if else to make sure that if the type is not TEXT, an error is displayed.