473,563 Members | 2,635 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

reference parameter question


I am writing a validation function: what I want to do
when an error is detected is to open a second
window containing error messages.
The form being validated is rather long, and there
are several points in the code where I write the
messages. So, I would like to have a separate function
just to open the second window with an appropriate
title (something like "the following errors were
detected in your form").
(something labout like this:

function validate(this){
var headerWritten = false;
....

//when I trap an error (done in many places)

if (!headerWritten ){
OpenSecondWindo w(secondWindow, secondWindowDoc ument);
headerWritten=t rue;
}
secondWindowDoc ument.write('ap porpriate error message');

My problem: secondWindow and secondWindowDoc ument seem to need
to be passed as references to this OpenSecondWindo w
function - how to do this???????

Of course, if you know of an easier way to do this, I'd be
grateful if you'd pass that bit of knowledge along ...

Thanks in advance.

Mitch Edelman
Jul 20 '05 #1
2 1247
On 2 Feb 2004 15:56:09 -0500, Mitch Edelman <ed*****@umbc.e du> wrote:

[snip]
if (!headerWritten ){
OpenSecondWindo w(secondWindow, secondWindowDoc ument);
headerWritten=t rue;
}
secondWindowDoc ument.write('ap porpriate error message');

My problem: secondWindow and secondWindowDoc ument seem to need
to be passed as references to this OpenSecondWindo w
function - how to do this???????

Of course, if you know of an easier way to do this, I'd be
grateful if you'd pass that bit of knowledge along ...


Return the reference. You don't seem to return anything from the function,
OpenSecondWindo w, so return a reference to the window object.

var secondWindow = OpenSecondWindo w();
var secondWindowDoc ument = secondWindow.do cument;

Mike

--
Michael Winter
M.******@blueyo nder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 20 '05 #2
I have read the following message from ed*****@umbc.ed u (Mitch Edelman)
and have decided to lend my vast knowledge.

The writer said:
I am writing a validation function: what I want to do
when an error is detected is to open a second
window containing error messages.
The form being validated is rather long, and there
are several points in the code where I write the
messages. So, I would like to have a separate function
just to open the second window with an appropriate
title (something like "the following errors were
detected in your form").
(something labout like this:

function validate(this){
var headerWritten = false;
...

//when I trap an error (done in many places)

if (!headerWritten ){
OpenSecondWindo w(secondWindow, secondWindowDoc ument);
headerWritten=t rue;
}
secondWindowDoc ument.write('ap porpriate error message');

My problem: secondWindow and secondWindowDoc ument seem to need
to be passed as references to this OpenSecondWindo w
function - how to do this???????

Of course, if you know of an easier way to do this, I'd be
grateful if you'd pass that bit of knowledge along ...

Thanks in advance.

Mitch Edelman


and my reply is:
Prior to validation create a variable
var errorMessage = "The following errors were detected in your form:"
At each error add a line to the errorMessage
errorMessage += "\nError xxxxx"
At the end
alert(errorMess age)

--
Dennis M. Marks
http://www.dcs-chico.com/~denmarks/
Replace domain.invalid with dcsi.net
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
9622
by: Murat Tasan | last post by:
i have a quick question... is there a way to obtain the reference to the object which called the currently executing method? here is the scenario, i have a class and a field which i would like to populate with a reference to the object that constructed this current object. i would attempt to accomplish this by setting the appropriate field...
3
1949
by: ded' | last post by:
Hello ! I've read in a magazine "reference parameter in operator= must be const, because in C++, temporary objects are const" and then my operator would not work with temporary objets. But, my compiler doesn't have temporary const objects. Are there any reasons to have a const reference parameter ? Thanks in advance for your help
110
9815
by: Mr A | last post by:
Hi! I've been thinking about passing parameteras using references instead of pointers in order to emphasize that the parameter must be an object. Exemple: void func(Objec& object); //object must be an object instead of
19
2128
by: daniel | last post by:
This is a pretty basic-level question, but I'd really like to know, so thanks for any help or pointers you can provide (like what I would google for ;o) Suppose: <code> myFunc() {
7
1990
by: Ralph Flaugher | last post by:
In C# objects are passed in functions by reference. Is there a way like in C++ to declare that the function does not alter the passed object? Something like: Foo(const Byte someThing) { } -- Ralph Flaugher
6
2834
by: Lenn | last post by:
Hi, Could someone clarify my confusion regarding passing reference types to a method with ref keyword and explain when it's practical to use it. It's my understanding that in .NET reference types hold a reference to an object as opposed to object data itself. So, when reference type parameter is passed into a method, a copy of objects...
4
1789
by: Michael Holm | last post by:
Calling the function "float dist = Splines.Pick(Vector2(x,y), 5.0f, type, &point);" The function is now defined as float BSpline::Pick(Vector2Coord, float radius, ePickType &type, Vector3 &point){}
4
1775
by: Everton Berz | last post by:
Hi, In the follow program I would like to have the parameter "c" in method "doSomething" as a value parameter, but it's running as a reference parameter. Why? How can I get parameter "c" as a value (or clone, copy)? Current result: value1 value2
12
3000
by: Bryan Parkoff | last post by:
I write my large project in C++ source code. My C++ source code contains approximate four thousand small functions. Most of them are inline. I define variables and functions in the global scope. The global variables and global functions are hidden to prevent from accessing by the programmers. All global functions share global variables....
275
12113
by: Astley Le Jasper | last post by:
Sorry for the numpty question ... How do you find the reference name of an object? So if i have this bob = modulename.objectname() how do i find that the name is 'bob'
0
7659
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7580
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7882
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7634
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5481
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5208
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3634
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2079
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1194
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.