Disable submit button - InfoPath Dev
in

InfoPath Dev

Disable submit button

Last post 01-11-2011 05:20 AM by shark59. 11 replies.
Page 1 of 1 (12 items)
Sort Posts: Previous Next
  • 03-11-2009 12:54 PM

    • bravo21
    • Not Ranked
      Male
    • Joined on 02-24-2009
    • Lynnwood, WA
    • Posts 6

    Disable submit button

     Hello,

    Is it possible to disable the submit button after it is pressed?

    I have a few forms that take a few seconds to submit and I do not want a user thinking that they did not press the button. I would like to just disable the submit button after the first time it is pressed so I don't receive duplicate data.

    Thank you,

    brav

  • 03-11-2009 03:52 PM In reply to

    Hey Bravo21 and welcome!

    Yes, just add an action after submit to set a field value that controls whether the button is enabled/disabled. If you don't have a field value in your form to use, you can add an XML resource file with a single entry <submitted></submitted> and set that secondary data source value. Then, just add conditional formatting to disable the button if that value is set.

    Cheers!

    Patrick Halstead
    Project Manager at Qdabra
  • 03-13-2009 09:45 AM In reply to

    • bravo21
    • Not Ranked
      Male
    • Joined on 02-24-2009
    • Lynnwood, WA
    • Posts 6

     Patrick,

     Thank you very much. I found exactly what you were talking about and it works perfectly!

     

  • 01-07-2011 09:21 PM In reply to

    Patrick,

    Your advise in above posting is very good. But I face a different challenge. I have 3 buttons: Submit, Approve and Reject. On the initial load of the form I need to hide Approve and Reject button. After user clicks Submit button I successfully generate an email, but my all 3 buttons are not on the form after the first email recipient receives it. I have to hide Submit and show Approve and Reject buttons. Can you please give me an advise how to hide the button and why do you think they disappear when I send an eamil?

    Thank you.

  • 01-09-2011 04:29 PM In reply to

    Do they actually disappear, or are they not there on your default view?  You need to make sure they are visible when the form is submitted to email.  I would think you would be doing one of 2 things:

    1. Switching to a view that contains the buttons without conditional formatting and switching to this view before the email submit action occurs (on button click, but before the submit), or
    2. You have conditional formatting on the approve/reject buttons that cause them not to be visible in a new form but that you're setting the value of a hidden field to make them visible, and this value is being set BEFORE THE EMAIL SUBMIT occurs (within the rules of the button)

    Either scenario should work, but are you attaching the template or sending the active view (both are options in email submits)?  If sending the form template, then it always opens to the default view, so you have to ensure the buttons are on the default view and that they are visible based off the current status of the form.

  • 01-10-2011 02:15 PM In reply to

     Hello,

    Thank you for your answer. What I actually have is a form with 3 buttons: Submit, Approve and Reject. On the initial load of the form I need to hide the Approve and Reject buttons. After Submit button is clicked the email is getting generated and the Submit button have to hidden. When the form gets to the 1st, 2nd or 3rd level managers the Submit button is no longer visible, but Approve and Reject buttons are present.

    Thank you.

  • 01-10-2011 02:18 PM In reply to

    shark59:

    Thank you for your answer. What I actually have is a form with 3 buttons: Submit, Approve and Reject. On the initial load of the form I need to hide the Approve and Reject buttons. After Submit button is clicked the email is getting generated and the Submit button have to hidden. When the form gets to the 1st, 2nd or 3rd level managers the Submit button is no longer visible, but Approve and Reject buttons are present.

    Ok, so what's the problem?  All of that sounds normal and easy.

  • 01-10-2011 02:38 PM In reply to

     Clayton,

    The problem is that I can't find a proper condition to use to hide the Submit button.

  • 01-10-2011 02:48 PM In reply to

    You just add conditional formatting that says, "If Field is equal to Value, then hide this control."  That will hide the button when whatever field is equal to whatever value.  The field and value are up to you.  THere has to be something in the form that matches your logic so that the button knows when to disable itself.  We can't tell you what field or value that is, but it's all very, very easy.  Just choose to set a field's value to a certain value at whatever point in time it needs to be set.  If that's upon initial submit, then add a rule to your submit button that sets a hidden field to some value, and compare against that value in your condition on the submit button.

    The way I do it is I always auto-generate my filenames by using the article on my blog.  Then, I check the strFilename field to see if it's blank or not.  If it's blank, I know it's a new form, so I don't hide the submit button.  If it's NOT blank, then I know it has been submitted, and I use that fact to make decisions on other fields/views/buttons.

  • 01-10-2011 05:34 PM In reply to

     Clayton,

    Thanks a lot for the advise. I was actually tried to use some conditions, but it works not the way I wanted. But I will use your suggestion about the name of the form.

    Thanks again.

  • 01-10-2011 07:45 PM In reply to

    I can't stress enough how simple it is.  It's just logic - black and white.  Share with us what your conditions were, and we can help you fix it.  Maybe it's just not clicking, but once you see it, it will make a ton of sense.  This concept is critical for any InfoPath development.  Without mastering/understanding this, you will be severely limited.

  • 01-11-2011 05:20 AM In reply to

    What I have is a request form with 3 buttons: Submit, Approve and Reject. The first thing I have to achieve is to hide Approve and Reject on the initial load of the form. For the Submit button under the Properties / Action I picked "Submit" option, but for the Approve and Reject buttons I picked "Rules and Custom Code". I'm not sure if this is the right way, but I picked these options.

    When the form is getting loaded I detect the user and populate the Requester field with the value from SharePoint using suggestion from your article. I also have 4 Person/Group picker controls for the Employee, Manager Level 1, level 2 and level 3. The Requester selects manually (???) all 3 managers using search in the Person/Group picker control and also enters some required fields on the form as well for the requested item. When everything is entered, Requester clicks the Submit button and email is getting send to the Manager Level 1. At this time I need to hide the Submit button and make sure that Approve and Reject buttons appear on the form. So when the level 1 manager receives the email he/she doesn't see the Submit button, but sees the Approve and Reject buttons. When level 1 manager approves the request, the email is getting generated and sent to manager level 2 and from this manager, when request is approved it goes to manager level 3. This is basically the description of the main functionality.

     Thank you for all your help!!!

     

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