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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:53:23+00:00 2026-05-27T11:53:23+00:00

Looking for some really quick help, contactForm={ that: this, lilfield: ‘I just equal this’,

  • 0

Looking for some really quick help,

contactForm={
    that: this,
    lilfield: 'I just equal this',
    fields: new Array("hc_name","hc_email","hc_telephone"),
    submit_button: jQuery("#hc_submit"),
    init: function(){
        that.lilAlert();
    },
    lilAlert: function(){
        alert("lets pump this out");
    }
}

The above is just an example, but effectively what i’m trying to achieve is that the variable that can be used to proceed calls rather than referencing the object ‘contactForm’ itself. Also that is a little safer to use than this, due to auto passing of this on events such as click etc with jQuery.

  • 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-27T11:53:24+00:00Added an answer on May 27, 2026 at 11:53 am

    Two things.

    1. Your that is pointing to the this that created the contactForm, not the actual contactForm as you expect.
    2. Your that is a property of the contact form so you need to access it via this.that or contactForm.that, which kind of breaks the original purpose.

    Either:

    1. Reference contactForm itself
    2. or define the thats inside the functions that need it

      init: function(){
          var that = this;
          that.lilalert();
      }
      

    If all you want to do is avoid this shenanigans, an alternative is using closures (and therefore lexical, static scope instead of dynamic binding via this)

    function make_contact_form(){
        var lilfield: 'I just equal this';
        var fields =  ["hc_name","hc_email","hc_telephone"]; //dont use new Array. its evil
        var submit_button = jQuery("#hc_submit");
        var init = function(){
            lilAlert(); //lilAlert is a name is scope. call it directly
        };
        var lilAlert =  function(){
            alert("lets pump this out");
        };
    
        return {
            lilfield: lilfield,
            fields: fields,
            submit_button: submit_button,
            init: init,
            lilAlert: lilAlert
        };
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Really quick here... I think I have the answer, but just looking for some
I'm testing out a new webcrawler and I'm looking for some good websites that
OK, this is just a quick question and I might take some slack for
I'm just looking for some advice really on CMS choice. The website will need
I'm looking to learn Windows PowerShell. Can someone give me some really good references
Looking for some help with a Labview data collection program. If I could collect
Looking at some code I'm maintaining in System Verilog I see some signals that
I am looking for a quick way to grab some data off of one
I've seen some really nice looking jQuery plugins to count down the number of
I think I've been too much time looking at this function and just got

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.