?
Solved

javascript error

Posted on 2003-03-18
9
Medium Priority
?
133 Views
Last Modified: 2013-12-24
The code below works fine on IE but not on netscape. Not submitting the form and getting javascript error on netscape.

function save(form1)
           {
             form1.submit();    
                                   
      }

<form name="form1" method="post" action="form2.cfm">
  <input type="checkbox" name="check" value="#t#-#t1#"
onclick="save();"<cfif #CHECKED# EQ "Y">Checked</cfif>>
</form>
0
Comment
Question by:sangh
[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
9 Comments
 
LVL 8

Accepted Solution

by:
TallerMike earned 100 total points
ID: 8159816
Your function is expecting a variable called "form1", and yet you're not sending it a variable when you call it. You should be doing the following to send the form object:

<input type="checkbox" name="check" value="#t#-#t1#"
onclick="save(this.form);"<cfif #CHECKED# EQ "Y">Checked</cfif>>

However, you should never name an expected variable in a function the same name as an obejct on your form. So rewrite your function like so:

function save(formObj)
          { formObj.submit(); }
0
 
LVL 8

Expert Comment

by:TallerMike
ID: 8159847
IE doesn't give you an error because the name of your expected variable is the same as an object on the form (form1). So when the function is run, it doesn't get any parameters, but knows that when you say 'form1' you mean the form on the page, not the input parameter. Netscape is expecting this input parameter and will NOT let you get away without scoping it. So if instead you don't want to send the parameter, you can do the following:

function save()
          { document.form1.submit(); }

<form name="form1" method="post" action="form2.cfm">
 <input type="checkbox" name="check" value="#t#-#t1#"
onclick="save();"<cfif #CHECKED# EQ "Y">Checked</cfif>>
</form>
0
 

Author Comment

by:sangh
ID: 8160120
when clicked on the each checkbox it refreshes the whole page in netscape. It dosen't look good. Is their a way when clicked on the checkbox save the checkbox value to database without clicking on the submt button. I have multiple pages.
0
ATEN's HDBaseT Presentation at InfoComm 2017

Hear ATEN Product Manager YT Liang review HDBaseT technology, highlighting ATEN’s latest solutions as they relate to real-world applications during her presentation at the HDBaseT booth at InfoComm 2017.

 

Author Comment

by:sangh
ID: 8160134
when clicked on the each checkbox it refreshes the whole page in netscape. It dosen't look good. Is their a way when clicked on the checkbox save the checkbox value to database without clicking on the submt button. I have multiple pages.
0
 
LVL 8

Expert Comment

by:TallerMike
ID: 8160203
First: If the solution above solved your problem, please select the response that helped you most as the answer.

Second: Clean up your questions. You have 4 open questions, some dating back to over a month, with no answers selected/points rewarded. Experts will not want to help you if you do not reward points and/or cleanup your questions.
0
 
LVL 8

Expert Comment

by:TallerMike
ID: 8160219
Third: If you have a new question, you will have to post a new question for it.
0
 
LVL 11

Expert Comment

by:hart
ID: 8193183
if you are using frames, then you could keep a page in a different frame and submit the checkbox values to that frame. and thus doing the appropriate updates.

if not you can pop up a small window and ask the user wether the changes have to be saved. and do the appropriate actions in this popped up window and later closing it.

This will avoid your refreshing hassle.

And yes i do agree with Tallermike.
give the points of this question to him and then create a new one.

I just gave some free advice :-)

Regards
Hart(Harish)
0
 
LVL 35

Expert Comment

by:mrichmon
ID: 10940698
No comment has been added lately, so it's time to clean up this question.
I will leave the following recommendation in the Cleanup topic area:

Accept TallerMike

Please leave any comments here within the next four days.

mrichmon
EE Cleanup Volunteer
0

Featured Post

Does Your Cloud Backup Use Blockchain Technology?

Blockchain technology has already revolutionized finance thanks to Bitcoin. Now it's disrupting other areas, including the realm of data protection. Learn how blockchain is now being used to authenticate backup files and keep them safe from hackers.

Question has a verified solution.

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

When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses
Course of the Month13 days, 2 hours left to enroll

777 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