Multiple submits

Hi everyone!

I thought I would give you a way to handle multiple submits in a form. Lets say you have a form that should be filled by both students and ordinary attendees. There are some fields that are specific to the students like name of school and name of education and for the attendee we might have fields like title and name of company. When they make the submit we want to make sure all required fields are filled, but only the required fields for that kind of person.

First of all the person should make a decision if he is a student or an attendee, the form could look like this.

When the person clicks one of the buttons a field named listener is set to Attendee or Student. This decides which fields (or sections) that are displayed on the form. To handle the submit and validation of fields I have two submit buttons that looks the same but have different rules applied to them. They are both hidden if listener is blank or is set to the other buttons value.

Here is how it looks in design mode where both submit buttons can be seen and you also can see the message that is thrown if not all required fields are filled.

I think it’s a pretty easy way to accomplish what I was looking for and should be pretty simple for any one to use as well.

CU!

/Niax

Advertisements

Validation in InfoPath

Hi everyone!

Due to a discussion in a thread at Microsoft Forum, I decided to create a post about a couple of ways to handle validation in InfoPath.

The two ways I will show you are these:

  • Disable a button until all questions are answered.
  • Showing a message if a question is missed.

This is the how the form looks like.

As you can see we have a couple of questions to answer and then we can move on to the next view to continue with more questions. To stop the user from being able to go to the next view we could disable the button, this is how.

First click on the button Next view, and then on Manage Rules in the ribbon.

Now for the button Next view create a Formatting rule called DisableButton, that looks like this.

Now the button can’t be used until Question1 and Question2 is answered. Use Prereview to make sure it works.

Ok, so now lets move over of how to show a message if the user missed to answer a question. First you have to delete the rule from the previous example.

These are the fields in the form.

First of all, above the button I have placed the field called Message, and it is formatted like this.

No border, read only and with the same color as the rest of the cell, this way it’s invisible until a message is written to it.

As before, choose Manage Rules for the button Next view, this time create two Action rules.

The first rule I name Message_Blank and this rule looks like this.

As you can see I use the action Set a field’s value and the only thing we do here is to set the field Message to nothing/blank. You should not add the apostrophes, InfoPath will do that for you, just leave the field blank.

Now we need to create one more rule to show the message. Let’s call it Message_Error, it’s the same kind of rule with a few differences and it looks like this.

As you can see we I have a condition, the message is not blank, but actually holds the text we would like to show the user. And last but not least, I have check marked Don’t run remaining rules… That is because the last rule this button should have is to switch view, but not if this rules condition is met.

This is how it will look like if the user trys to move on before all questions are answered.

That’s it!

Try it in preview to make sure you done it the right way.

CU!

/Niax