Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 319
  • Last Modified:

Issue in onsubmit in internet explorer

i have an issue in onsubmit event. It must return true or false while click enter key button in keyboard, in ie 7,8 it always returns true.

Any suggestions.

Thanks for help
0
Praveen_Bobbili
Asked:
Praveen_Bobbili
  • 7
  • 7
1 Solution
 
OmniUnlimitedCommented:
Under what conditions would it return false?  Can you post some code?
0
 
leakim971PluritechnicianCommented:
you don't handle key event the same way on IE and FF.
Check Which key has been pressed? section on this page : http://www.quirksmode.org/js/events_properties.html
0
 
Praveen_BobbiliAuthor Commented:
Below is source code..........

onsubmit=javascript:return CheckForOptions('QuestionText','DependentParentID','IsQuestionDependent','ErrorMessage','undefined','txtChoiceText','539e5d24-7d48-4bea-9587-6bae129c3e05')

Even though this function returning false form is being posted to the server in IE 8,7. but this is working fine in IE 9.  
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
OmniUnlimitedCommented:
Can you just try:
 
onsubmit="return CheckForOptions('QuestionText','DependentParentID','IsQuestionDependent','ErrorMessage','undefined','txtChoiceText','539e5d24-7d48-4bea-9587-6bae129c3e05');"

Open in new window

0
 
OmniUnlimitedCommented:
I am assumming you have this event on the <form> tag.
0
 
Praveen_BobbiliAuthor Commented:
No luck..............
0
 
OmniUnlimitedCommented:
What happens if you just do onsubmit="return false;"?
0
 
Praveen_BobbiliAuthor Commented:
Form is being submitted.............................if this function returns true then only  form needs to be submitted, but when it is returning false also form is being submitted..
0
 
OmniUnlimitedCommented:
You must have something wrong in your form.  Can you post the tag just as you have it (just the tag with all its attributes only.  I don't need to see the rest of the inputs.)
0
 
Praveen_BobbiliAuthor Commented:
<form id="SbtButton" onsubmit="javascript:return CheckForOptions('QuestionText','DependentParentID','IsQuestionDependent','ErrorMessage','true','txtChoiceText','186815b5-fc22-4559-b5ba-807fc5f77545')" action="/surveyQA/Survey/AddQuestion" method="post" jQuery1510335410809809651="3">
0
 
OmniUnlimitedCommented:
That jQuery1510335410809809651="3" attribute is not a normal attribute.  You must have other javascript working on this form.  Try disabling each of the javascripts that affect the form (with the exception of the CheckForOptions() function) and see if the problem persists.
0
 
Praveen_BobbiliAuthor Commented:
I have searched some forums regarding jQuery1510335410809809651="3", they have stated that this is hot fix given by jquery team Only for ie to solve some issue, this tag is not coming into picture when we are browsing using Firfox and etc.........

But this is working fine in IE 9. This is only issue with IE 8 and lower versions.
0
 
OmniUnlimitedCommented:
Ok, I understand, but my point is that in order for that attribute to affect your tag at all, you must have javascript running.  I am stating that I believe that the only way for your form tag to fail in IE (or any browser for that matter) is that you have other javascript that is interfering with the normal operation of the form, because onsubmit="return false;" will stop form submission in all versions of IE.  If you don't believe me, set up a blank html page and with a simple form tag with onsubmit="return false;" and a submit button.

Try removing all <script> tags from your <head> section (except, perhaps, the one that has the CheckForOptions() function) and see if the form submits.
0
 
Praveen_BobbiliAuthor Commented:
Ok, i will work on that......... Any suggestion in between.
0
 
Praveen_BobbiliAuthor Commented:
Partially success with your approach.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 7
  • 7
Tackle projects and never again get stuck behind a technical roadblock.
Join Now