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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T22:35:35+00:00 2026-05-19T22:35:35+00:00

I must have read about arguments in functions and how they are variables and/or

  • 0

I must have read about arguments in functions and how they are variables and/or objects and pass value a million times and still real life examples keep throwing me off. The keyword “this” in this example points to the object of the function, being the form element. OK got that.

Now the function outside the window.onload event handler has a parameter named “frm”. My question is whether it’s necessary to give this parameter the same name as the id of the form element that will be passed to it (in this case ‘frm’)? I thought this didn’t matter. For all it mattered one could put anything inside the argument just as long as it’s reused as a local variable inside of the function itself.

window.onload = function() {
    // validation for submit button
    document.frmFlight.onsubmit = function() {
        //console.log("what is 'this'?: "+this);
        return validate(this);
    }       
}

//----------------------------------------------------------
function validate(frm) {
    var valid = true;
    return valid;
}   
  • 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-19T22:35:36+00:00Added an answer on May 19, 2026 at 10:35 pm

    It’s not clear exactly what you’re asking, but the name you give the argument in the function signature doesn’t relate in any way to the name of anything you might be passing into the function. It can be (just about) anything you want it to be. These are all equivalent:

    function validate(frm) {
        // ...
    }
    
    function validate(theForm) {
        // ...
    }
    
    function validate(foo) {
        // ...
    }
    

    Your use above is just fine, because when you set up an event handler in the way you have (by assigning a function to the onsubmit property), when the event fires, the function will be called such that this references the DOM element for the form. Assuming that’s what the validate function uses its argument for (regardless of what it calls it), you’re in good shape.

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

Sidebar

Related Questions

First, I must say that I have read several post about this at StackOverflow
I must have read a hundred forum and blogposts about this, all talking about
Good day folks I must have read about 20 different articles/approaches about how to
I have read several posts about WSDL and SOAP but still I'm confusing the
I have read on MSDN( see Important note ) that RSACryptoServiceProvider must be disposed.
They must have hidden the bug database somewhere. I could not find it with
I have read various blogs about Serialization and the use of serialVersionUID. Most of
I have read the ARM document about Cortex-M3 (or M0) and it say it
According to Apple documentation and other documentation I have read about on disk encryption
I've read a bit about automating the creation of object ids, but still getting

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.