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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:55:50+00:00 2026-05-25T18:55:50+00:00

I have a static html form layout where i add extjs form fields using

  • 0

I have a static html form layout where i add extjs form fields using the “renderTo” config. In order to have form validation and simple submit methods i want to add the fields to a form panel. As the layout is managed by the html frame i don’t want the form to be rendered by the panel (panel has html frame as contentEl and this should be used as is).

In extjs3 i could achieve this by adding the field not to the panel but to the BasicForm (formpanel.getForm().add(…)) but in extjs4 this method seems to be gone.

How can i do this using extjs4?

Thanks in advance.

  • 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-25T18:55:51+00:00Added an answer on May 25, 2026 at 6:55 pm

    Since you already have a Panel that uses the contentEl to render HTML into its body, I recommend to stick with this approach:
    Replace the panel with an Ext.form.Panel instance – the configuration, particularly the contentEl config – can remain unchanged.

    The code provided here will override a standard Ext class (Ext.layout.Layout) and introduce support for a ‘renderItemTo’ config property on child items of any Ext container or panel instance (including Ext.form.Panel).
    The value of the config property should be the ID of an already rendered DOM node, e.g. a DIV element that is part of the HTML fragment used in as the contentEl of the parent container’s body.

    Ext.require(['Ext.layout.Layout'], function() {
        Ext.override(Ext.layout.Layout, {
            renderItem: function (item, target, position) {
                if(item.renderItemTo) {
                    // render 'renderItemTo' components into the specified DOM element
                    item.render(item.renderItemTo, 1);
                    // don't allow container layout to seize the component
                    item.layoutManagedHeight = 2;
                    item.layoutManagedWidth = 2;
                } else {
                    // just use standard Ext code for non-renderItemTo components
                    this.callOverridden(arguments);
                }
            },
            isValidParent: function(item, target, position) {
                // signal Ext that we are OK with were our 'renderItemTo' component is right now
                // otherwise it would get moved during the layout process
                return item.renderItemTo ? true : this.callOverridden(arguments);
            }
        });
    });
    

    Usage:

    var panel = Ext.create('Ext.form.Panel', {
        contentEl: 'form', // the DOM element ID that holds the HTML fragment for the body
        title: 'My FormPanel with special FX',
        items: [
            {
                xtype: 'textfield',
                renderItemTo: 'text1', // the ID of a DOM element inside the HTML fragment
                fieldLabel: 'Label 1',
            },
            {
                xtype: 'textfield',
                renderItemTo: 'text2', // the ID of a DOM element inside the HTML fragment
                fieldLabel: 'Label 2'
            }
        ]
    });
    

    I uploaded a working example to JSFiddle (note: resize the window if you experience a render problem – this is related to JSFiddle, not my override).

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

Sidebar

Related Questions

Using MVC, I have an html form helper in my view: using (Html.BeginForm(ActionOne, ControllerOne))
I have an URL: /Account.aspx/Confirm/34a1418b-4ff3-4237-9c0b-9d0235909d76 and a form: <% using (Html.BeginForm()) { %> <fieldset>
I have a jQuery scrollbar in a static html page. The code works fine
I have an existing website running on IIS6 that has only static HTML pages.
I have a web application where the masterPage/template contains some static HTML that never
I have a website that right now, runs by creating static html pages from
I have an e-mail template which is just a plain, static HTML page. I
I have some static resources (images and HTML files) that will be localized. One
I am having some trouble generating a web form using fields specified in an
I have a complex form that has a static section and one that can

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.