This is a migrated thread and some comments may be shown as answers.

Clear text when edit or focus

1 Answer 171 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Bhauvik T
Top achievements
Rank 1
Bhauvik T asked on 06 Apr 2017, 04:42 AM

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 .

Thanks. 

1 Answer, 1 is accepted

Sort by
0
Todor
Telerik team
answered on 11 Apr 2017, 07:16 AM
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 ([property.name 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.

Regards,
Todor
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.
Tags
DataForm
Asked by
Bhauvik T
Top achievements
Rank 1
Answers by
Todor
Telerik team
Share this question
or