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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:04:22+00:00 2026-05-26T19:04:22+00:00

How do I go about cloning a Dojo form (dijit.form.Form) with its child widgets?

  • 0

How do I go about cloning a Dojo form (dijit.form.Form) with its child widgets? Ideally, i’d like to change the Id’s of the clone widgets as well. I also would be interested in cloning any events that might be attached to the widgets.

I played a bit with dojo.clone but that only works for DOM objects.

Thanks

  • 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-26T19:04:22+00:00Added an answer on May 26, 2026 at 7:04 pm

    Assuming inheritance is really what you need, then I’d just make a new widget. Assuming you are using the async loader and Dojo 1.7. I’d do something like:

    define([
        'dojo',
        'module',
        'dijit/form/Form',
        'dijit/form/TextBox',
        'dijit/_TemplatedMixin',
        'dijit/_WidgetsInTemplatedMixin'
    ], function (dojo, module, Form, TextBox, _TemplatedMixin, _WidgetsInTemplatedMixin) {
        // I have a wrapper for declare that handles this, but...
        return dojo.declare(module.id.replace(/\//g, '.'), [Form, _TemplatedMixin, _WidgetsInTemplatedMixin], {
    
            widgetsInTemplate: true,
    
            // Make a template, I usually use a separate file.
            templateString: '<form data-dojo-type="dijit.form.Form">' +
                                 '<input data-dojo-type="dijit.form.TextBox" />' +
                            '</form>'
    
            postCreate: function () {
                this.inherited(arguments);
                // Attach your specialized events.
            }
        });
    });
    

    If you’re using the sync loader, then you’ll want dojo.declare:

    dojo.provide('mynamespace.CustomForm');
    
    // Do this for all child widgets and anything else you use.
    dojo.require('dijit.form.Form'); 
    dojo.require('dijit._Templated');
    dojo.require('dijit.form.TextBox');
    
    dojo.declare('mynamespace.CustomForm', [dijit.form.Form, dijit._Templated], {
    
            widgetsInTemplate: true,
    
            // Make a template, I usually use a separate file.
            templateString: '<form dojoType="dijit.form.Form">' +
                                 '<input dojoType="dijit.form.TextBox" />' +
                            '</form>'
    
            postCreate: function () {
                this.inherited(arguments);
                // Attach your specialized events.
            }
        });
    });
    

    Your module will then be available with var container = someElement; new path.to.File({}, container);. Or you could declare the widget in your markup. Let me know if I can make this more specific or apply to different versions of Dojo.

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

Sidebar

Related Questions

I started cloning an SVN repository using the git-svn's clone operation. After about 6
How would you go about deep cloning a document in MongoDB (mongoid) I've tried
There's a lot of hubub about cloning JavaScript objects. However, as I understand it,
There's something I don't fully understand about node cloning with the PHP's DOM api.
Im all aware about services like github and such which provide a really nice
I have a question about cloning within a loop, two problems actually and im
I'm trying to use CodeIgniter for one of my github projects and would like
I'm working on a real-time space strategy game clone which at its time did
For a small software development I would like changes to follow a defined process,
I found this answer about cloning java objects. However, with the approach in the

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.