Validation for length

created validation for length variable.