Browser enabled forms - InfoPath Dev
in

InfoPath Dev

Browser enabled forms

Last post 04-27-2010 04:16 AM by alexia_net. 9 replies.
Page 1 of 1 (10 items)
Sort Posts: Previous Next
  • 04-26-2010 04:01 AM

    Browser enabled forms

    Hi. I have created a form in InfoPath and I have userd some code in C# for creating some connections to an Sql database and for doing some other things. When I have tried to make it browser enabled i got many errors and I was suggested to use the FormState property to store data. Can someone inlight me please. What exactly is this? What should i do in order to convert my code. I am new with InfoPath. Sorry for my quesitons. Thank you!

  • 04-26-2010 04:08 AM In reply to

    • Prasad
    • Not Ranked
    • Joined on 04-29-2009
    • Hyderabad
    • Posts 19

    In InfoPath, you cannot decalre variables directly. To declare the variables you need to use the form state dictionary.

    Regards,
    P V V S V Prasad
    Invesco
    MyBolg
  • 04-26-2010 04:09 AM In reply to

    Member variables (global variables) are not supported by Browser enabled forms, so you cannot use them, instead you can use form state. to store variables. just follow the syntax given 

    private object _memberVariable

    {

    get

    {

    return FormState["_memberVariable"];

    }

    set

    {

    FormState[
    "_memberVariable"] = value;

    }

     

    Qazi Anis
    Technical Architect
    Bitwise Inc
  • 04-26-2010 04:35 AM In reply to

     Thank you for your answers.

    Take this code for example. How should it be converted, I have tried but the values are not assigned if i use FormState(".."). I am using InfoPath 2007

            Private Sub InternalStartup(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Startup
                AddHandler DirectCast(EventManager.ControlEvents("btnSave"), ButtonEvent).Clicked, AddressOf btnSaveBuilding_Clicked

                Dim xnFormName As XPathNavigator
                Dim xnDoc As XPathNavigator
                Dim Info As String
                Dim currentIdentity As WindowsIdentity

               strInfo = ""

                'create navigators
                xnFormName = Me.MainDataSource.CreateNavigator()
                xnDoc = Me.MainDataSource.CreateNavigator()


                'citesc domeniul si userul din windows
                currentIdentity = WindowsIdentity.GetCurrent()
                strInfo = currentIdentity.Name


                'adaugare user in campul de pe form
                xnFormName.SelectSingleNode("/my:View1/my:txtInfo", Me.NamespaceManager).SetValue(strInfo)


            End Sub

    Thank you!

  • 04-26-2010 06:11 AM In reply to

     The form state applies only to global variables or to any of them?

  • 04-26-2010 06:14 AM In reply to

    the above code seems to be fine, you need viewstate for global variables only. There might be some other code that throws errors

    Qazi Anis
    Technical Architect
    Bitwise Inc
  • 04-26-2010 11:09 PM In reply to

     Hi. Thank you for answering. So, if I replace all global variables with local ones, and I use functions with parameters, all should be ok right? Thank you!

  • 04-27-2010 12:00 AM In reply to

    yes everything should be right

    Qazi Anis
    Technical Architect
    Bitwise Inc
  • 04-27-2010 03:31 AM In reply to

     Hi. Thank you. I have changed all varibles to local, and I am using functions to pass the variables. I have no error in the form when i make it compatible with the web-based forms to fill it using a browser. However, when i publish it in Sharepoint I get a message saying: The form was closed. What could it be? The form works fine localy, on my machine where i have infopath. I use custom code for saving the information into the database. Thank you!

  • 04-27-2010 04:16 AM In reply to

     Here is a complete solution about how to publish a form. Use Internet Explorer.

Page 1 of 1 (10 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.