Fill Text Box from Drop Down Selection

F

Franck Dauché

Hi Andy,

Your drop-down is linked to a node (f1) in your schema. You need to copy
the value to the node (f2) behind your textbox.
You can do this easily by code behind your form using ofr example C#;
In the OnAfterChange Event of your drop down, just use code such as:
IXMLDOMNode oN1 =
thisXDocument.DOM.selectSingleNode("/my:Folder1/..../my:f1");
IXMLDOMNode oN2 =
thisXDocument.DOM.selectSingleNode("/my:Folder1/..../my:f2");
f2.text = f1.text;

Hope this helps.

Franck Dauché
 
A

Andy Jax

Thanks for the quick response Frank. I am extremely new to InfoPath. I have
several objects with the same name (i.e. GuidelineDescription). One is a
drop-down to fill the query text field. The query text field has the same
name. Using your F1 and F2 example, how do I differentiate the two objects
with the same name?

Thanks
 
F

Franck Dauché

Hi Andy,

Even if your fields have the same name, their XPAth from the root are
different (in your schema). That is what the
selectSingleNode("/my:Folder1/..../my:f1") is all about. You need to replace
/my:Folder1/..../my: by the actual full path in your schema. Then both can
be actually named f1...

Franck Dauché
 
A

Andy Jax

Sorry for the less than intelligent questions, but does the folder path
relate to the folder set-up in the Data Source view? Is the were I get my
selectSingleNode path?

Thanks
Andy
 
F

Franck Dauché

Yes, from the Data Source view, you can see the entire hierarchy from the root.

Franck Dauché
 
A

Andy Jax

Thanks for your help. I am able to get a drop-down selection populating
another field. I appreciate your time, effort, and patience.

Andy
 

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