Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

javascript error

Posted on 2003-03-18
9
Medium Priority
?
135 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
8 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
[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

 

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

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Question has a verified solution.

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

One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
Screencast - Getting to Know the Pipeline
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

580 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