Clear text when edit or focus

Thread is closed for posting
2 posts, 0 answers
  1. Bhauvik T
    Bhauvik T avatar
    5 posts
    Member since:
    Dec 2009

    Posted 05 Apr 2017 Link to this post

    Could you please help me how to implement that function on TKDataFormTextFieldEditor ? What i need is the text field will be clear or empty when user click on that .


  2. Todor
    Todor avatar
    798 posts

    Posted 11 Apr 2017 Link to this post

    Hello Bhauvik,

    Thank you for writing.

    Your requirement sounds like our hint text feature - this is a text which is visible while the value of the editor is nil. Here's an article which contains a snippet with the usage of hintText property. If this is not suitable and you really need to clear the text when the text field get the focus, you need to make your ViewController the delegate of the TextField which is part of the TKDataFormTextFieldEditor:

    -(void)dataForm:(TKDataForm *)dataForm setupEditor:(TKDataFormEditor *)editor forProperty:(TKEntityProperty *)property
        if ([ isEqualToString:@"details"]) {
            TKTextField* tf = (TKTextField*)(editor.editor);
            tf.delegate = self;

    Then when the editor gets the focus, you will clear the text:

    - (void)textFieldDidBeginEditing:(UITextField *)textField {
        textField.text = nil;

    I hope this information helps.

    Telerik by Progress
    Want to build beautiful Android apps as well? Check out UI for Android which enables the same set of scenarios, allowing you to create the same great app experience on both iOS and Android.
Back to Top