0

Is there a way to add a button in infopath that contains a hyperlink. I would like to press a button that follows some rules and then takes you to a url.

If this is not possible, do you have any ideas for a work around?

6
  • Is it the form submit button? Sep 12, 2017 at 16:10
  • yes, it is the form submit button. But I would like it to take me to a custom URL.
    – J.Choe
    Sep 12, 2017 at 16:29
  • What does the URL lead to? Sep 12, 2017 at 16:35
  • it leads to an approval task
    – J.Choe
    Sep 12, 2017 at 16:36
  • ok. Is your form hosted in InfoPath Form Web Part? Sep 12, 2017 at 16:47

1 Answer 1

0

There is no way to Redirect a "Submit button" but to add script on the page. You can do this using Designer.

Find the ID of your button and add the following code:

<script>     
function setEventHandler()
{
 var btnSubmit = document.getElementById("ctl00_Something");

 btnSubmit.onmouseup = function(){Button.OnClick(this, event); window.location='http://www.google.com';};
}
</script>

Call this function in your pageLoad or you can write the code inside your pageLoad function.

Here, onmouseup will call default method of Info Path for closing the form and then the even will be binded.

Try it and let me know if it works. I haven't tried it.

Your Answer

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

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