• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 233
  • Last Modified:

Javascript "AdviceBox" Doesn't Work with NS4

I'm trying to add an "AdviceBox" to a form. The AdviceBox works with IE5 and NS6, but I can't seem to get it to work with NS4. Here's the URL:

http://www.msdetta.com/design.html#form

Thanks in advance for your help.

MsDetta
0
MsDetta
Asked:
MsDetta
  • 3
  • 2
  • 2
  • +1
2 Solutions
 
gator4lifeCommented:
The getElementById() method, as in:

document.getElementById("adviceBox").value = helpers[adviceNumber];

did not exist in NS4.x.  This method is part of the Document Object Model (DOM) Level 1 specification and is only available in modern browsers (IE5.0+, NS6.0+, etc.).

If you want to set something like this up in NS4.x, you have to create a separate <layer> for each message that you want to have, and then you dynamically show or hide these layers with onMouseOver and onMouseOut events.  These layers would also have to dynamically replace the area where the current <textarea> is.  So, this would require you to use conditionals and the document.write() method to put the right content into the browser based on browser type.

gator4life
(chomp, chomp)
0
 
ZvonkoSystems architectCommented:
Make this change:

function messages(adviceNumber) {
   //document.getElementById("adviceBox").value = helpers[adviceNumber];
   document.FORM1.adviceBox.value = helpers[adviceNumber];
}

Good luck,
Zvonko

0
 
ZvonkoSystems architectCommented:
Or this version:

function messages(adviceNumber) {
   //document.FORM1getElementById("adviceBox").value = helpers[adviceNumber];
   //document.FORM1.adviceBox.value = helpers[adviceNumber];
   MM_findObj("adviceBox").value = helpers[adviceNumber];
}

0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
gator4lifeCommented:
Thanks Zvonko, I forgot you could do it that way! : )
0
 
MsDettaAuthor Commented:
Neither of those suggestions worked to add the AdviceBox to NS4. Do I need to add appName if statements?

I'm also having another problem in that my checkForm.js is not working and the form is being submitted to email without the data validation. Any and all suggestions are deeply appreciate.
0
 
gator4lifeCommented:
MsDetta -

I don't know why the suggestions Zvonko gave aren't working right now, but I do have an answer for your second question.

In your code, you have:

<script type="text/javascript" language="JavaScript" src="checkForm.js">
     // Set form element object properties to event-handler functions
     document.FORM1.onSubmit = checkFormData();
</script>

and then:

<form name="FORM1" onSubmit="checkForm.js" method="POST" action="/cgi-sys/formmail.pl">

This is the incorrect way to set up form validation.

Change those areas of code to this:

<script type="text/javascript" src="checkForm.js"></script>

and this:

<form name="FORM1" onSubmit="return checkFormData();" method="POST" action="/cgi-sys/formmail.pl">

gator4life
(chomp, chomp)
0
 
MsDettaAuthor Commented:
Gator4life,

Thanks so much :) The form now validates and works in IE5 and NS6. I still can't figure out why the "AdviceBox" doesn't work in NS4.

I'll try checking the browser as I've already got a ckBrowser.js script working.

Thanks for the help.

MsDetta
0
 
jaysolomonCommented:
*******************************************************
******PLEASE DO NOT ACCEPT THIS COMMENT AS ANSWER******
*******************************************************
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area:
RECOMMENDATION:

 - [Split Zvonko / gator4life]

Please leave any comments here within the next seven days.
*******************************************************
******PLEASE DO NOT ACCEPT THIS COMMENT AS ANSWER******
*******************************************************

jAy
EE Cleanup Volunteer
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now