0

How do I clear the TextField in blackberry? Here's the qml:

Container {
                        horizontalAlignment: HorizontalAlignment.Center
                        verticalAlignment: VerticalAlignment.Bottom
                        leftPadding: 75
                        rightPadding: leftPadding
                        bottomPadding: 40

                    TextField {
                        id: tfComment
                        hintText: qsTr("add comment")
                        inputMode: TextFieldInputMode.Text
                        input {
                            submitKey: SubmitKey.Submit
                            onSubmitted: {
                                cppObj.onCommentSubmitClicked(tfComment.text, "");
                                lComment.text = tfComment.text;
                            }
                        }
                    }
                }

Container {
                        horizontalAlignment: HorizontalAlignment.Center
                        verticalAlignment: VerticalAlignment.Bottom
                        bottomPadding: 200
                        leftPadding: 20
                        rightPadding: leftPadding

                       Label {
                           id: lComment
                           verticalAlignment: VerticalAlignment.Bottom
                           horizontalAlignment: HorizontalAlignment.Center
                           text: cppObj.desc
                       }
                    } 

I want to clear the data entered to the TextField so there'll be room for me to comment another. How do I do that?

Sunseeker
  • 1,503
  • 9
  • 21
kev
  • 155
  • 1
  • 11

2 Answers2

2

textField->resetText()

The documentation is here:

http://developer.blackberry.com/cascades/reference/bb__cascades__textfield.html

BaCaRoZzo
  • 7,502
  • 6
  • 51
  • 82
Konrad Lindenbach
  • 4,911
  • 1
  • 26
  • 28
1

Try this inside the onSubmitted handler:

tfComment.Text = ""
BaCaRoZzo
  • 7,502
  • 6
  • 51
  • 82
Hareen Laks
  • 1,432
  • 2
  • 17
  • 33