Solved

Another question about a Javascript form

Posted on 2014-02-25
4
198 Views
Last Modified: 2014-02-25
I have a hard time accepting "that" something works, I need to know "why" in order to feel like I really understand what's going on. That said, I've got a question about a JavaScript form:

<span onmouseover="this.style.textDecoration='underline';"
onmouseout="this.style.textDecoration='none'" //like a link, user sees the "add physician" text underlined when the mouse over it

onclick='loadlookup  //going to call a function when the user clicks on the "add physician" text

(dataform,"physician_lookup",entityid,physicianid,physician,"physician")'>add physician</a>

The above code, from what I'm learning, is a function that is called when the user clicks on "add physician." Thing is, it's not just a function, is it? It's actually instantiating a form object, correct? I'm basing this on http://javascript.about.com/od/hintsandtips/ss/domscriptwalkthrough.htm.

That being the case, I want to understand what "dataform" is. The actual function is:

function loadlookup(form, page, entityid, id, name, label) {
      lookuplabel.innerHTML = '<span class=\'legend\'>Click name to add:</span>  '+label;

The first element being "form," is what defines this as an object versus a mere function, correct? But what is the significance of "dataform" as far as the way it's being called?

I want to be able to get my mental arms around that.
0
Comment
Question by:brucegust
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 52

Assisted Solution

by:Carl Tawn
Carl Tawn earned 200 total points
ID: 39885891
dataform should be a reference to a javascript variable declared elsewhere, which is being passed to the function. I would guess that it is somewhere higher up in the page and probably holds a reference to the <form> element in your page.

If you have a copy of your page available somewhere that we could see then it would be easier to be more specific.
0
 

Author Comment

by:brucegust
ID: 39885989
Carl, you nailed it. I found it as I was going through some code down the page and BOOM! Epiphany! Thanks!
0
 
LVL 56

Accepted Solution

by:
Julian Hansen earned 300 total points
ID: 39886150
The above code, from what I'm learning, is a function that is called when the user clicks on "add physician."
Correct
Thing is, it's not just a function, is it? It's actually instantiating a form object, correct?
No, it is just a function. Instantiating an object requires the new operator which is not in evidence. The function might create an object but there is no way of telling from the way it is called.
The first element being "form," is what defines this as an object versus a mere function, correct?
Nope - it is just a function.
And as Carl pointed out dataform is just a variable declared somewhere on your page. If it is in quotes or a number it is a value if it is a string without quotes it is a variable declared somewhere else.
0
 

Author Comment

by:brucegust
ID: 39886232
I get it. After looking at the code closer and trying to digest it more, the function isn't instantiating a form as much as it's just compiling the variables that will be used in an iframe down the road. Thanks, guys!
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question