• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 503
  • Last Modified:

How do I write code to check for empty drop-down list box

Hi there,
I need to verify that a value has been entered into a drop down box on my infopath form. I am brand new to infopath and c# so please excuse my ignorance.

What i have is a button that submits drop down/text box values to a sharepoint list. I have tried to use the standard 'Data Validation' on the drop down fields themselves, but the c# code executes first before the built in 'Data Validation' goes to check the value.

Basically I need an example of c# syntax in infopath that will check for a null value in the drop down boxes.
Here is some pseudocode of what im after

if (dropdown1 is empty) then
stop executing code and set focus to dropdown1
else
process rest of code

if anyone could provide an example that would be great.

Thanks.
0
cscb08
Asked:
cscb08
1 Solution
 
Clay FoxDirector of Business IntegrationCommented:
You could hide or disable the button, so that it is not clickable until the dropdown has a value.  That is typically what i do.
0
 
cscb08Author Commented:
Hi clayfox. Cheerss for that. I have found the solution, I was able to find some example c# code that now works.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now