Solved

strange behaviour on form submit in safari 3.0.4(523.12.9)

Posted on 2007-12-04
9
312 Views
Last Modified: 2008-02-01
I have inherited a site that has the following in a form onSubmit

onSubmit="ValidateUserEdit(frm_UserEdit, '#sLanguageFlag#');return false"

the js validation has
if(error){
alert(strError)
}else{
frm.submit()
}

everything works fine except in safari 3.0.4 (win and mac) safari 2.0.4 also worked fine.
in testing, the validation is working, then the return is executed but regardless the form submits which results in an error in processing as while the action page is called the cf code says that the form object is not present so it cannot process the actions. short of rewriting the entire js, which is not in the budget/tim frame, i don't know what else to do, looking for suggestions....
thanks
0
Comment
Question by:James Rodgers
  • 4
  • 3
9 Comments
 
LVL 23

Expert Comment

by:Ashish Patel
ID: 20406510
Try this if you are having just 1 form in your entire page.
document.forms[0].submit();

or else change the forms[0] with the name of your form like frm or whatever you have used.
document.frm.submit();
0
 
LVL 25

Author Comment

by:James Rodgers
ID: 20406582
the issue isnt with the frm.submit(), even if the validation fails something forces teh action page to be called without the form object getting sent to the action page.
0
 
LVL 23

Expert Comment

by:Ashish Patel
ID: 20406607
1. Remove return false from the below line.

onSubmit="ValidateUserEdit(frm_UserEdit, '#sLanguageFlag#');return false"

2. Try modifying this in the function like below.

if(error){
alert(strError)
return false;
}else{
return true;
}
0
 
LVL 25

Author Comment

by:James Rodgers
ID: 20406699
done that...same results
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 23

Expert Comment

by:Ashish Patel
ID: 20406727
Okay now last attempt. Just undo the 2nd point i gave and put back your original code.

if(error){
alert(strError)
}else{
frm.submit()
}
0
 
LVL 25

Accepted Solution

by:
James Rodgers earned 0 total points
ID: 20406862
found what it was....who ever wrote the code originally put an href AROUND the submit button
WTH is that?!!?!? so now im off to kick someone's ....
0
 
LVL 23

Expert Comment

by:Ashish Patel
ID: 20406882
Glad to hear this!!! So, always the basic is you try something different and look at all scopes. Good Luck.
0
 
LVL 1

Expert Comment

by:Vee_Mod
ID: 20641207
Closed, 500 points refunded.
Vee_Mod
Community Support Moderator
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

706 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now