Disable submit button - InfoPath Dev Sign in | Join | Help in Newbie Questions InfoPath (Entire Site) InfoPath Dev InfoPath Dev is dedicated to bringing you the information and tools you need to be successful in your Microsoft Office InfoPath development projects. Home Blogs Forums Photos Downloads InfoPath Dev » InfoPath » Newbie Questions » Disable submit button Disable submit button Last post 01-11-2011 05:20 AM by shark59. 11 replies. Page 1 of 1 (12 items) Sort Posts: Oldest to newest Newest to oldest Previous Next 03-11-2009 12:54 PM bravo21 Joined on 02-24-2009 Lynnwood, WA Posts 6 Disable submit button Reply Contact 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 Filed under: submit, C#, conditianal formatting 03-11-2009 03:52 PM In reply to Patrick Halstead Joined on 08-08-2006 Posts 5,112 Re: Disable submit button Mark as Not AnswerMark as Answer... Reply Contact 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 HalsteadProject Manager at Qdabra 03-13-2009 09:45 AM In reply to bravo21 Joined on 02-24-2009 Lynnwood, WA Posts 6 Re: Disable submit button Mark as Not AnswerMark as Answer... Reply Contact 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 shark59 Joined on 01-07-2011 Posts 12 Re: Disable submit button Mark as Not AnswerMark as Answer... Reply Contact 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 warrtalon Joined on 12-13-2007 Denver, CO Posts 980 Re: Disable submit button Mark as Not AnswerMark as Answer... Reply Contact 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: 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 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. Clayton Cobb || SharePoint MVP || Clayton's SharePoint MadnessPlanet Technologies || Federal Partner of the Year (2005-2010) || SLG Partner of the Year (2010) 01-10-2011 02:15 PM In reply to shark59 Joined on 01-07-2011 Posts 12 Re: Disable submit button Mark as Not AnswerMark as Answer... Reply Contact 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 warrtalon Joined on 12-13-2007 Denver, CO Posts 980 Re: Disable submit button Mark as Not AnswerMark as Answer... Reply Contact 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. Clayton Cobb || SharePoint MVP || Clayton's SharePoint MadnessPlanet Technologies || Federal Partner of the Year (2005-2010) || SLG Partner of the Year (2010) 01-10-2011 02:38 PM In reply to shark59 Joined on 01-07-2011 Posts 12 Re: Disable submit button Mark as Not AnswerMark as Answer... Reply Contact 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 warrtalon Joined on 12-13-2007 Denver, CO Posts 980 Re: Disable submit button Mark as Not AnswerMark as Answer... Reply Contact 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. Clayton Cobb || SharePoint MVP || Clayton's SharePoint MadnessPlanet Technologies || Federal Partner of the Year (2005-2010) || SLG Partner of the Year (2010) 01-10-2011 05:34 PM In reply to shark59 Joined on 01-07-2011 Posts 12 Re: Disable submit button Mark as Not AnswerMark as Answer... Reply Contact 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 warrtalon Joined on 12-13-2007 Denver, CO Posts 980 Re: Disable submit button Mark as Not AnswerMark as Answer... Reply Contact 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. Clayton Cobb || SharePoint MVP || Clayton's SharePoint MadnessPlanet Technologies || Federal Partner of the Year (2005-2010) || SLG Partner of the Year (2010) 01-11-2011 05:20 AM In reply to shark59 Joined on 01-07-2011 Posts 12 Re: Disable submit button Mark as Not AnswerMark as Answer... Reply Contact 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.
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
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,
Thank you very much. I found exactly what you were talking about and it works perfectly!
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.
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:
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.
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.
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.
Clayton,
The problem is that I can't find a proper condition to use to hide the Submit button.
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.
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.
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.
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!!!