By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,473 Members | 1,267 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,473 IT Pros & Developers. It's quick & easy.

reference parameter question

P: n/a

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){
OpenSecondWindow(secondWindow, secondWindowDocument);
headerWritten=true;
}
secondWindowDocument.write('apporpriate error message');

My problem: secondWindow and secondWindowDocument seem to need
to be passed as references to this OpenSecondWindow
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
Share this Question
Share on Google+
2 Replies


P: n/a
On 2 Feb 2004 15:56:09 -0500, Mitch Edelman <ed*****@umbc.edu> wrote:

[snip]
if (!headerWritten){
OpenSecondWindow(secondWindow, secondWindowDocument);
headerWritten=true;
}
secondWindowDocument.write('apporpriate error message');

My problem: secondWindow and secondWindowDocument seem to need
to be passed as references to this OpenSecondWindow
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,
OpenSecondWindow, so return a reference to the window object.

var secondWindow = OpenSecondWindow();
var secondWindowDocument = secondWindow.document;

Mike

--
Michael Winter
M.******@blueyonder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 20 '05 #2

P: n/a
I have read the following message from ed*****@umbc.edu (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){
OpenSecondWindow(secondWindow, secondWindowDocument);
headerWritten=true;
}
secondWindowDocument.write('apporpriate error message');

My problem: secondWindow and secondWindowDocument seem to need
to be passed as references to this OpenSecondWindow
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(errorMessage)

--
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 discussion thread is closed

Replies have been disabled for this discussion.