Solved

Another question about a Javascript form

Posted on 2014-02-25
4
195 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
  • 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 55

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Add shadow behind div 5 25
Html Table looping 4 26
html Uncheck Checkbox 2 25
Html value of radio 14 30
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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…

829 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