Submit button with rules and managed code. Browser enabled form. - InfoPath Dev
in

InfoPath Dev

Having trouble finding a blog or post that answers your question? Check out our Custom Search Page

Submit button with rules and managed code. Browser enabled form.

Last post 04-11-2010 10:48 PM by Qazi Anis. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 04-09-2010 03:31 AM

    Submit button with rules and managed code. Browser enabled form.

    Hello

    I am developing an infopath form that requires to be redirected to the main page after the processing is complete, the page should be redirected in around 10 seconds. I have come to know from some of posts in other forums and others that infopath does not have any inbuilt functionality to redirect to a page of your choice. So what I have done is that I right clicked on the button and do a "Edit form code". On button click I wrote only these 2 statements

    Thread.Sleep(10000);

    System.Web.HttpContext.Current.Response.Redirect("http://localhost:333/sites/Intranet/Development/default.aspx"); 

    The rules on button click specify form data Submit on certain conditons and not on others. Before writing this code everything worked fine. The form got submitted properly, every rule worked. But after adding this code to the template when I fill out a form and submit using this template I get this error on clicking the button: "An error occurred submitting this form to the Web Server". No rule seems to be working.

    I have a few questions on this one and related:

    1. Foremost, how to get rid of this issue?

    2. When there are both rules and code on a button click what is the order in which the execution takes place.

    3. Does this error mean that I will have to rewrite my rules in the form of code?

    4. Any codeless work around for this?

    5. How to debug infopath managed code?

    Appreciate any help. Thanks in advance.

  • 04-09-2010 07:09 AM In reply to

    Re: Submit button with rules and managed code. Browser enabled form.

    1) rules get executed before code.

    2) by default after submission the form is redirected to the page that is mentioned in the source Parameter in address bar.

    3) to debug managed code, put breakpoints on the form code and just press f5,

    Qazi Anis
    System Analyst
    Bitwise Solutions
  • 04-09-2010 11:24 PM In reply to

    Re: Submit button with rules and managed code. Browser enabled form.

    Thanks Qazi.

    Actually when I asked about debugging the managed code infopath forms I meant broswer enabled forms. May be what you said works well with infopath client forms.

    Also any idea on what is going wrong in my case. Anyone?

  • 04-11-2010 10:48 PM In reply to

    Re: Submit button with rules and managed code. Browser enabled form.

    if you are using a submit button and written that code in submit event then you need to write the below line also

    e.CancelableArgs.Cancel = true;

    also in the Redirect you might need to use a string variable instead of hardcoding. sometimes long hardcoded values dont work properly. it is better to assign them to some strign variable and then pass that variable to the Redirect statement

    Qazi Anis
    System Analyst
    Bitwise Solutions
Page 1 of 1 (4 items)
Copyright © 2003-2012 Qdabra Software. All rights reserved.
View our Terms of Use.