XPath id function to refer to another form field

P

p_le_sueur_1

Dear All,

I am experimenting with InfoPath for a project whereby I display a
text
field dependent on the value of a dropdown field which is REFERRED TO
BY NAME within a second text field. This would allow me to build up a
series of textboxes which are made invisible by another field (eg a
dropdown) the referenced dropdown in question could therefore change
at
runtime.

The resultant XML from my experimental template looks like this:

<?xml version="1.0" ...standard Infopath blah blah blah...>
<my:Group1>
<my:DDLChoice>Yes</my:DDLChoice>
<my:TxtBox1></my:TxtBox1>
<my:TxtBox2>DDLChoice</my:TxtBox2>
</my:Group1>
</my:myFields>


The process is this:

The my:txtbox1 control in the InfoPath template will have a
conditional
format on it which will pick up the name of a control (my:DDLChoice)
from
the my:TextBox2 control, and make my:TextBox1 visible if DDLChoice is
"Yes" or invisible if it is "No".

I am having problems with the expression in the conditional formatting
on
TxtBox1; what I have so far is:

id(concat("../my:", ../my:TxtBox2)) = "No"

But this gives the following error:

InfoPath cannot open the following view: View 1
The XSL transform for the View XSL failed.

This name may not begin with the '.' character:

-->.<--./my:

I have run another test where I have placed the following expression
into
the default value for TxtBox1 (and removed the conditional
formatting):

concat("../my:", TxtBox2)

When I preview the form I get the following in TxtBox1:

../my:DDLChoice

Which looks to me like it is picking up the fieldname correctly;
however;
If I try and add the id function around it:

id(concat("../my:", ../my:TxtBox2))

I get this error when validating the function:

This name may not begin with the '.' character:

-->.<--./my:DDLChoice

I'm obviously missing something with regard to the "id" function
(undoubtedly due to my lack of experience with XPath), can
anybody help, or provide any useful examples??

Thanks in anticipation,

Paul Le Sueur.
 

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