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 6890905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:20:29+00:00 2026-05-27T06:20:29+00:00

I need to generate ui component dynamically at runtime. I am able to generate

  • 0

I need to generate ui component dynamically at runtime. I am able to generate the component, but my problem is how to get value entered in dynamically generated field?

I am doing something like this.

    final HorizontalFieldManager hfm = new HorizontalFieldManager();

    for (int i=0; i<5; i++)
    {
        hfm.add(new EditField());
    }

Is there any way to set tag of field and later we could find control by tag?

  • 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-05-27T06:20:30+00:00Added an answer on May 27, 2026 at 6:20 am

    As far as I know, there is no way to set a unique id for an EditField. Maybe you can use a sub class of it, and implement your own unique id mechanism.
    Or, as your HorizontalFieldManager holds nothing but EditField, you can get a field by position, and cast it to EditField. Like this:

    Field f = hfm.getField(index);
    EditField ef = (EditField)f;
    

    UPDATE:


    public class MyEditField extends EditField {

    private int _id;
    
    public MyEditField(int id) {
        _id = id;
    }
    
    public int getID() {
        return _id;
    }
    

    }

    class MyHfm extends HorizontalFieldManager {

        //This is a cache, which holds all EditFields.
    

    private IntHashtable _editfields = new IntHashtable();

        public EditField getById(int id) {
            EditField ef = (EditField)_editfields.get(id);
            return ef;
    }
    
        public void add(Field f) {
            super.add(f);
            if (f instanceof MyEditField) {
                _editfields.put(((MyEditField)f).getID(), f);
            }
        }
    
        public void delete(Field f) {
            super.delete(f);
            if (f instanceof MyEditField) {
                _editfields.remove(((MyEditField)f).getID());
            }
        }
    

    }

    And then you can do like this:

        MyHfm hfm = new MyHfm();
        hfm.add(new MyEditField(0));
        hfm.add(new MyEditField(1));
        //get the field with id
        EditField f = hfm.getById(1);
    

    There are some other delete/add methods, remember to handle the cache inside them.

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

Sidebar

Related Questions

For my web service component, I need to generate a relatively large XML (~500
I need generate thumbnails for a bunch of jpegs (200,000+) but I want to
I need to be able to generate dependency diagrams programmatically. I'd like it to
I need to set the action for a commandLink dynamically. <ice:repeat value=#{mLeft.links} var=xxx> <cvu:leftLink
I need to set the null value string for a dropDownChoice component. The default
I need generate action links outside controllers. I can use Html.Action in Views, Url.Action
I need to generate a random integer between 1 and n (where n is
I need to generate some passwords, I want to avoid characters that can be
I need to generate thumbnails from a set of jpg's that need to have
I need to generate a directory in my makefile and I would like to

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.