Locking a field in an infopath form with vbscript

K

kayrogage

I have a form that contains a repeatable element called property, I
always want the first property to have the name "Product ref" and for
it to have the check box named child selected.

I can set the values for these fields in the form via vbscript but now
I want to be able to lock them so that the user can't change the value
of these fields in the first property only. They can do what they like
in any subsequent property elements.

Is it possible to lock a field programmatically via VBScript?

Thanks

Kay
 
G

Greg Collins [InfoPath MVP]

Create a simple .xml file and add it as a secondary data connection. This .xml file would have a field for each main-dom field you want to be able to lock/unlock.

Now set conditional formatting on the main-dom fields to be readonly if the associated secondary dom field has a certain value (i.e. "true" or "1").

Now use code or rules to set the value of the secondary dom field in order to lock/unlock the main-dom field.

Simple!
 

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