Eureka: TextAreaRow RuleMaxLength Forces Text Entry

Created on 22 Nov 2016  路  3Comments  路  Source: xmartlabs/Eureka

I'm creating a TextAreaRow() and adding a rule for max length, however it forces you to then add at least one character, even if the row is not required.

i.e.

TextAreaRow() {
     $0.placeholder = "Question"
     $0.textAreaHeight = .dynamic(initialTextViewHeight: 100)
     $0.add(rule: RuleMaxLength(maxLength: 300))
}

Will not validate with more than 300 characters, but will also not validate if you enter no text.

Adding

$0.add(rule: RuleMinLength(minLength: 0))

Does not change anything.

Validations

Most helpful comment

I think we my need to re-open this one. I am using 4.0.1, and looking at the same problem.

All 3 comments

This seems to be fixed in master branch code.

    public func isValid(value: String?) -> ValidationError? {
        guard let value = value else { return nil }
        return value.characters.count > Int(max) ? validationError : nil
    }

Which Eureka version are you using?

I think we my need to re-open this one. I am using 4.0.1, and looking at the same problem.

Seems like not working I've limited to 255 characters but allowed more than that.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

annjawn picture annjawn  路  3Comments

zoul picture zoul  路  3Comments

Tomas1405 picture Tomas1405  路  3Comments

allanrojas picture allanrojas  路  3Comments

calli23 picture calli23  路  3Comments