Mayank
Mayank

Reputation: 1139

E-Mail ID format validation in a TextField using QML in Blackberry 10

I have designed a login page in QML for my app on BB10.

In the username field I want to perform the email-id format validation.

How can I accomplish this ?

thanks

Upvotes: 2

Views: 2768

Answers (1)

Vignesh Vino
Vignesh Vino

Reputation: 1238

To enter email and password we add two TextField in the CommonDialog. You can try with this code

TextField {
    id: textFieldEmail
    width: contentColumn.width - textEmail.font.pixelSize*5
    echoMode: TextInput.Normal
    errorHighlight:false;
    placeholderText: qsTr( "Enter email" )
    anchors.left: parent.left
    anchors.leftMargin:textEmail.font.pixelSize*5
    validator: RegExpValidator { regExp:/\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/ }
    onTextChanged: {
        textError.state ="hide";
        textError.text = "";
    }
}

Upvotes: 4

Related Questions