Hello:
No, I don't think anything you are doing will require code. First, let's add that field.
-
Change your task pane to display the Data Source task pane
-
Select the main data source
-
Right click the root folder (probably myFields)
-
Select Add
-
Name the field isSubmitted (or another name, if you like)
-
Change the Data type to True/false (boolean)
-
Select OK
Now you have another field that you can use to know whether the form has been submitted. Next, let's set some rules.
-
Right click the button you are using for submitting
-
Change the Action to Submit
-
Select the Submit Options button
-
Select Perform custom action using Rules
-
Select the Rules button
-
Select the Add button
-
Give your Rule a meaningful name, like "Submit to database"
-
Select Add Action ...
-
Change the action to Submit using a data connection
-
Make sure the data connection is your main data connection
-
Select OK
-
Select OK again
This will set up the submission to the database. Next, we'll set a rule to set the value of isSubmitted.
-
Select the Add button again to add another rule
-
Give your rule a meaningful name, like "Set isSubmitted"
-
Select Add Action ...
-
Change the action to Set a field's value
-
Select your isSubmitted field in the field area
-
Type the word true in the value area
-
Select OK
-
Select OK again
Finally, we add the rule for email submission. All of these actions could have been added to a single rule, but sometimes when you are new, it is easier to only have a single action in every rule. That way if something doesn't work the way you anticipate, you can deselect different rules to track down the problem. So, to submit our form to email:
-
Select the Add button again to add another rule
-
Give your rule a meaningful name, like "Send email"
-
Select Add Action ...
-
Change the action to Submit using a data connection
-
Make sure the data connection is your email submit connection
-
Select OK
-
Select OK again, and once more to close that window
For the grand finale, we'll set that conditional formatting on the button.
- In the Button Properties, select the Display tab
- Select the Conditional Formatting button
- Select the Add button
- In the first dropdown, select your isSubmitted field
- The second dropdown should say "Is equal to"
- In the third dropdown, select Type text
- Type in true
- Select the Hide this control checkbox
Hilary Stoupa / Microsoft InfoPath MVPQdabra® Software / Streamline data gathering to turn process into knowledge