DropDown value set by code

R

Richard

I want to be able to specify the DropDown Value by code,
The DropDown properties box does not allow editing this value nor selecting
a function .
Editing the .xsl file , I have been able to change the Display, Is there a
way to do this for Value also ??
I have seen 3 places in the xsl file related to this.
Is this safe to do ??
 
S

Scott L. Heim [MSFT]

Hi Richard,

You do not have programmatic access to the controls on an InfoPath form;
however, InfoPath is completely data driven so you can do this through the
XML node that the drop-down list is bound to.

You will need to look at using the "selectSingleNode" method to get the
node and then the "text" property to set the value.

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.
 
R

Richard

Hi Scott,
The data connection is a web service, and it populates the dropdown box, so
when do I change the values??

I want to use these values in the subsequent codes , so, I have to have a
handle to a function that loads the dropdown box ??
 
S

Scott L. Heim [MSFT]

Hi Richard,

Please accept my apologies but I guess I am unclear on exactly what you are
trying to accomplish.

If your web service is used to populate the drop-down box, what are you
trying to change? Can you provide me with some additional details on your
design and what you are trying to do?

Thanks Richard,

Scott L. Heim
Microsoft Developer Support

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

Richard

Hi Scott,
my web service returns sequence of :
<name>
<prefix>Mrs.</prefix>
<given>Ellen</given>
<family>Ross</family>
</name>

If I drag a DropDown box and bind it to name, the value and display can only
be set to a given field like prefix, given or family , whereas, I want the
value to be a concat of prefix , given and family. ! the reason I need it
this way , is that the other controls I am going to use need to use the
current value of the first dropdown box, and for that reason , I need the
rest of the information in the name .
 
S

Scott L. Heim [MSFT]

Hi Richard,

Thank you for the clarification. So as you found, you can only bind to one
field and display one field - is it possible to concatenate the values in
your web service code? If not, you could look at using a text box on your
form that you could use code (or possibly a Rule) to set the value to the
result of concatenating these values together.

Scott L. Heim
Microsoft Developer Support

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

Richard

Hi scott,

I was hoping that I do not have to change the web service , but I did it
finally..
thanks.
 

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