Sathish Kumar
Sathish Kumar

Reputation: 369

Scala Play Framework Build in Validation

I used the build in validation in play framework to validate the name using validation.match, but it throws an "identifier expected but 'match' found"

package controllers    
import play.*
import play.mvc.*
import play.data.validation.Validation

object Application extends Controller {    

    def adduser = {
        val name = params.get("name")
        validation.match(name, "[A-Za-z ]+").message("Please enter valid name")
    }
}

Upvotes: 0

Views: 786

Answers (1)

Aaron
Aaron

Reputation: 4194

I believe you intend to use the "matches" function that the String type provides. 'match' itself is a reserved word, which is why the compiler is complaining.

Upvotes: 3

Related Questions