Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8398949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:10:23+00:00 2026-06-09T21:10:23+00:00

I have created textfield Dynamically i need to access the text entered in the

  • 0

I have created textfield Dynamically i need to access the text entered in the textfield. Please help me to do this.

 -(void)createHHDynamicFieldForYValue:(int )yVal
  {

NSString *lblStr=[[NSString alloc]initWithString:[[healthyHeartFieldsAry objectAtIndex:tagHHCount] objectForKey:@"TestName"]];

dynamicHealthyHeartLbl=[[UILabel alloc] initWithFrame:CGRectMake(50,yVal,278,45)];
dynamicHealthyHeartLbl.backgroundColor=[UIColor clearColor];
dynamicHealthyHeartLbl.textColor=[UIColor colorWithRed:17/255.0 green:61/255.0 blue:83/255.0 alpha:1];
dynamicHealthyHeartLbl.textAlignment = UITextAlignmentLeft;
dynamicHealthyHeartLbl.text=lblStr;
dynamicHealthyHeartLbl.font = [UIFont boldSystemFontOfSize:18];
[healthyHeartScrollView addSubview:dynamicHealthyHeartLbl];
[dynamicHealthyHeartLbl release];
[lblStr release];



dynamicHealthyHeartImgVw=[[UIImageView alloc] initWithFrame:CGRectMake(375, yVal, 278,kTxtImgHgVal)];
dynamicHealthyHeartImgVw.image=[UIImage imageNamed:@"birth_date.png"];
dynamicHealthyHeartImgVw.backgroundColor=[UIColor clearColor];
[healthyHeartScrollView addSubview:dynamicHealthyHeartImgVw];
[dynamicHealthyHeartImgVw release];



dynamicHealthyHeartTxtFld=[[UITextField alloc] initWithFrame:CGRectMake(380,yVal,278,kTxtImgHgVal )];
dynamicHealthyHeartTxtFld.borderStyle = UITextBorderStyleNone;
dynamicHealthyHeartTxtFld.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
dynamicHealthyHeartTxtFld.textAlignment=UITextAlignmentLeft;
dynamicHealthyHeartTxtFld.textColor=[UIColor colorWithRed:17/255.0 green:61/255.0 blue:83/255.0 alpha:1];
dynamicHealthyHeartTxtFld.font = [UIFont systemFontOfSize:18];
dynamicHealthyHeartTxtFld.backgroundColor = [UIColor clearColor];
dynamicHealthyHeartTxtFld.autocorrectionType = UITextAutocorrectionTypeNo;
dynamicHealthyHeartTxtFld.returnKeyType = UIReturnKeyDone;
dynamicHealthyHeartTxtFld.clearButtonMode = UITextFieldViewModeWhileEditing;
dynamicHealthyHeartTxtFld.autocapitalizationType=UITextAutocapitalizationTypeNone;
dynamicHealthyHeartTxtFld.delegate = self;
dynamicHealthyHeartTxtFld.placeholder=[[healthyHeartFieldsAry objectAtIndex:tagHHCount] objectForKey:@"TestName"];
dynamicHealthyHeartTxtFld.tag=tagHHCount;
[healthyHeartScrollView addSubview:dynamicHealthyHeartTxtFld];
[dynamicHealthyHeartTxtFld release];


[healthyHeart_TxtFldAry addObject:dynamicHealthyHeartTxtFld];

[dynamicHealthyHeartTxtFld release];


tagHHCount++;


}

int YVal=35;
tagHHCount=0;
NSLog(@"healthyHeartFieldsAry Count %d",[healthyHeartFieldsAry count]);
for (int i=0; i<[healthyHeartFieldsAry count]; i++)
{
    [self createHHDynamicFieldForYValue:YVal];
    YVal=YVal+80;
}

In TextField Did End Editing

    - (void)textFieldDidEndEditing:(UITextField *)textField
    {
        if(enteredHealthyHeart)
        {
            for(int i=0;i<[healthyHeart_TxtFldAry count];i++)
            {
                if(textField == [healthyHeart_TxtFldAry objectAtIndex:i])
                {
                    getHHTag=textField.tag;
                    //              UITextField *tempTxtFld=[healthyHeart_TxtFldAry objectAtIndex:getHHTag];

                dynamicHealthyHeartTxtFld=[healthyHeart_TxtFldAry objectAtIndex:getHHTag];
                if([dynamicHealthyHeartTxtFld.text length]>0)
                {
                    NSString *tempStr=dynamicHealthyHeartTxtFld.text;
                    NSLog(@"tempStr %@",tempStr);
                    if(![self checkForDecimalValue:tempStr])
                    {
                    Custom_Alert *alert=[[Custom_Alert alloc] initWithTitle:@"Alert" message:@"Please Enter Numeric Values" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
                    [alert show];
                    [alert release];

                }
                else
                {

                    if(([tempStr intValue] >= [[[healthyHeartFieldsAry objectAtIndex:getHHTag] objectForKey:@"MinVal"] intValue])&&([tempStr intValue] <= [[[healthyHeartFieldsAry objectAtIndex:getHHTag]objectForKey:@"MaxVal"]intValue]))
                    {
                        NSLog(@"validation Succcess!!!");
                    }
                    else
                    {
                        Custom_Alert *alert=[[Custom_Alert alloc] initWithTitle:@"Alert" message:@"Please check the Details" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
                        [alert show];
                        [alert release];
                    }


                }
            }


            [textField resignFirstResponder];
            //return YES;

        }
    }

}

}

I want to know how to access the textField Text. How to identify which textfield text is entered. Any help ???

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T21:10:24+00:00Added an answer on June 9, 2026 at 9:10 pm

    If you have declared the textfield in your interface file, you can access it via it’s instance variable:

    NSLog(@"text from textfield: %@", dynamicTextField.text);
    

    or via the property:

    NSLog(@"text from textfield: %@", self.dynamicTextField.text);
    

    But if you create many textfields in a for loop do like this:

    while creating the textField, say:

    dynamicTextField.tag = x;
    

    where “x” is the incremented integer of your loop.

    now, to access it’s value, say:

    for(UITextField *texter in self.view.subviews)
       if(texter.tag == 1)//or any other tag number you have specified on creating the textField
           NSLog(@"textfield with tag 1 contains text: %@", texter.text);
    

    You just have to remember which tag number was assigned to the desired textfield

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created some textFields dynamically: for (int a=0; a<10; a++) { UITextField *textField
I have created a custom tag that looks like this: def textField = {
I encountered that problem already a few times: I have a dynamically created textfield,
I have created 3 classes as following Ext.mine.TextParent - Inherting from Textfield Ext.mine.child.TextChildA -
I have created one jsp form which contains the username textfield. On the click
i have textbox controls that are created dynamically in the ASP.NET. I want to
I'm not sure if I created this topic correctly, but basically I have a
i have a problem in creating radio buttons dynamically, i have a text box
I have created some tables with text fields inside, like in the contacts for
The Issue I need to maintain the state of a dynamically created table through

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.