Setting Default value for Dropdown List

R

Rohit

Hi,

I populate my Drop-down list box with a XML file. How do set a default value?

Thanks,
Rohit
 
S

Scott L. Heim [MSFT]

Hi Rohit,

You can add a Rule that gets applied when the form is opened:

1) Open your InfoPath solution in Design View
2) From the Tools menu, choose Form Options and then select the Open and
Save tab
3) Click the Rules button
4) Click Add
5) Click Add Action
6) Choose Set a Field's Value form the Action drop-down list
7) Click the "builder" button next to Field and select your drop-down list
8) In the Value field, enter the value you want to be the default (Note:
this must match what is being "stored" in this list - not necessarily what
is being "displayed")
9) Click OK until you are back to your form
10) Test!

Each time a new form is created from your XSN, your drop-down list will now
reflect the default you specified.

I hope this helps!

Best Regards,

Scott L. Heim
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.
 
S

Scott L. Heim [MSFT]

Hi Rohit,

Or you can do it the easy way...which is what Greg suggested! :)

Simply right-click on the node in your data source that the drop-down list
is bound to, choose Properties and then enter the default value.

Sorry I didn't include this....

Best Regards,

Scott L. Heim
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.
 
W

Weisen

Weisen Thanks Scott.

Your answer is helpful and half what I want.

I bound Dropdown List Box to Access database directly and set the field is
mandatory that means not blank. After seting value as "Select Department",
the default display of the field is "Select Department" that is what I want.
The problem is that you can let the "Select Department" as a name of
department without selection, and the validation does not tell you this field
is blank or not.

Any suggestion is much appreciated.

Thanks again for you suggestion!

Weisen
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top