0

I have put a snippet of JavaScript into a Script Editor Web Part. It's function is to display an alert box and redirect the page after an Infopath form submission. I got it from this website and modified it.

https://askmanisha.wordpress.com/2013/08/20/redirection-to-a-page-on-infopath-form-closure-inside-an-infopath-form-web-part/

    <script>
 function pagecontainerload()
 {
  setTimeout(setEventHandler,5000);
 }

 function setEventHandler()
 {
  var btnSend = document.getElementById("ButtonID");

  btnSend.onmouseup = function(){Button.OnClick(this, event); alert("Your request has been successfuly submitted.");      window.location='website.com';};
 }
 </script>

The script works fine in Chrome and IE, but not in Firefox.

Any suggestions?

1
  • 2
    Check the web console for errors. Better yet install firebug and check the console for errors. Commented Jul 28, 2015 at 19:47

2 Answers 2

1

The problem was in the event being undefined. IE and Chrome are okay with it, but FF doesn't like it. In the last line, the code should be function(event){Button.OnClick(this, event)

1
  • Yeah, you are correct. I see the same issue in my browser Commented Jul 29, 2015 at 23:27
0

May be something: under IE, getElementById looks for elements by ID and by name, while under FF, it's only by ID. Are you sure your ButtonID element has its ID set to ButtonID and not only its name?

If the name attribute has to be used, you may call getElementsByName instead (mind it may return more than one element).

1
  • Sorry, I just wrote "Button ID" in instead of the actual ID since it was so long and I didn't think it was that important. So it is not looking for the name, but the ID.
    – clew3
    Commented Jul 29, 2015 at 14:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.