Get Handle To Submit Data Connection Button - InfoPath Dev
in

InfoPath Dev

Get Handle To Submit Data Connection Button

Last post 08-31-2010 09:23 AM by Rui Rosa Mendes. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 11-12-2009 10:40 AM

    Get Handle To Submit Data Connection Button

    Got this SharePoint Library Submit data connection on this Form.  On the Form there's a "Submit" button associated with all that. I want to get a handle to that button programmatically so I can disable and or enable the button under various conditions.

    Can I do that? I mean get a handle to the button. I've been on Google for the past hour, can't really find anything on it.

  • 11-12-2009 12:45 PM In reply to

    Re: Get Handle To Submit Data Connection Button

    Would you rather do that or just use no code and turn it off completely, then create custom buttons in your form that have conditional formatting and perform different actions depending on the person and/or workflow status?  I don't think you really need to programmatically interact with the built-in submit button - I just turn that sucker off in Tools > Form Options > Open and Save (or Browser tab if it's a browser form).  With custom submit buttons on the form canvas, you don't need any code and can easily choose the behavior with conditional formatting and views.

  • 11-12-2009 01:03 PM In reply to

    Re: Get Handle To Submit Data Connection Button

    When the form is brought up for the first time, the user fills out the form, submits the form to the document lib where it originated from. That's done programmatically. The Form sends email to various people that are obtained from the web.config <appsettings> key value pairs. Don't want hardcoded email recipents.

    The Email contains the Forms data that was input. If a user navigates to the doc lib where the Form was saved to and brings it up, I want to hide the "Submit" button. In other words, I want to prevent the user from re-submitting the Form. Preservation of data.

    You can do all that "out of the box"?

     

  • 11-12-2009 01:11 PM In reply to

    Re: Get Handle To Submit Data Connection Button

    Of course, just do what I said.  Completely turn off the "submit" button that is in the toolbar.  Use your own submit buttons in the body of the form and do whatever you want with them.  Not much reason to use the toolbar items, because you can't do anything with them from a design perspective.

    • Turn off the toolbar first.  
    • Drag a button to your canvas
    • Double-click the button and click Rules (don't click edit form code)
    • Leave the pulldown as the default, or you can change it to submit if you want to do that, but I don't use the built-in submit
    • Set your rules anyway you want with any conditional formatting you want.
    • Also, hide or show the button by using conditional formatting on the Display tab.
    • You can either have multiple buttons for multiple people and multiple situations, or in your case where other people need to view with no ability to submit, simply create a new view that has no submit button on it, and use Form Load rules to switch the view based on identity or status of the form - depends on your requirements

    Why are you having to use code to submit the form?  Why do you need code to send the email?  I don't ever hard code email addresses just to send emails dynamically.  I use the built-in abilities of SharePoint and InfoPath to retrieve that data based on whatever the process is.  An example of how I do this is here:

    InfoPath - Get user information without writing code (extended)

  • 11-12-2009 01:30 PM In reply to

    Re: Get Handle To Submit Data Connection Button

    I don't use the tool bar that's turned off. I've used a Data Connection that sends email & submits the form. In the FormsEvents_Submit event, I programmatically get the email recipients and send the email.

    The form is a content type. It's used in a number of various document libs as the only object when a user selects "New" form. The code programmatically determines where it was launced by the use of e.InputParameters["SaveLocation"] in the FormsEvents_Loading event. That value is saved in the FormState Object. 

    All that is done to change the FolderURL and Filename propterties of the FIleSubmitConnection Object that's cast from the this.DataConnections

    Having another View sounds like a good idea.

  • 11-12-2009 02:24 PM In reply to

    Re: Get Handle To Submit Data Connection Button

    Ok, well you don't have to send the email with the submit.  You can just have a regular submit and use a workflow to send the emails.  You should be able to get the email addresses of whoever you want without code and pass that data to the workflow for sending as many emails as you need.

  • 08-31-2010 09:23 AM In reply to

    Re: Get Handle To Submit Data Connection Button

     

    Hi, Definitly I can do a lot in a custom  button. I create my web service submit data connection, I set it up on buttom Rules along with several verification operations. But I would like to do all this, without using Rules.

    I want to use the button clicked event, but here I experience a great dificulty handling the submit data webservice connection.

    I call my SaveXXXXX (submit data webservice connection) , with a MyFields as an argument, but this data allways arrive empty to the web service. Using Rules all works perfectly!

     It seems when I setup the SaveXXXX conection using Roles, some tranformation is appllied to MyFileds data!?

     Any hint to pass through  this problem?

     

    Thanks, Rui 

     

     

     

    Rui Rosa Mendes
    Development Manager
Page 1 of 1 (7 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.