Set required on conditional basis

C

crc.01

Hi group, we are working on an Infopath project that asks us to make certain
fields requierds based on selection of an option button. Was hoping this was
possible without code but we cant find a rule or condition that works. Could
someone point us in the right direction?
 
G

Greg Collins [InfoPath MVP]

You can use Data Validation to do this. Add your custom condition right in there.
 
C

crc.01

Greg, thanks for your help. Let me see if I can clarify; Data Validation sees
to prompt me to provide an inline alert or message box and not change the
property of another field from not required to "cannot be blank". Our
objective is to force a free text response if one of a set of option buttons
are selected.
 
G

Greg Collins [InfoPath MVP]

You need to place the custom data validation on that "other field". It would have a condition based on the field you are currently attempting to place the custom data validation on.

I.e. right now you have fields F1 and F2 and are attempting to have F1 modify the "cannot be blank" value of F2. This is not the correct approach. Instead, place custom data validation on F2 with a condition based on the value of F1. Make sense?
 
C

crc.01

Greg, got that but I dont see an option in the rules or data validation where
setting the "Cannot be blank" = true is an option. Does this require a line
of code?
 
G

Greg Collins [InfoPath MVP]

This is "custom" validation... you just set some text which says "Cannot be blank" and that message will appear to the user the same as if you had checked that box.
 
C

crc.01

I just tried this and Wow! Its simplistic but rather obtuse. Where was this
documented, how would anyone know to do this?
Oh well, thanks so much for the assistance!
 
G

Greg Collins [InfoPath MVP]

I don't know that the specific scenario was documented by Microsoft, but with an understanding of the feature itself you will be able to do this and a whole lot more.
 
C

crc.01

Greg, thanks for all your help with this but there is one item to clarify now
that I have tried this. The procedure works from the prospective of turning
the text box to required or "Cannot be blank". However, what I found during
implementation is the box continues to indicate an error with a red hashed
line around it even after a text entry is made. Am I missing some attribute
that is placed on the field related to my Data Validation check?
 
C

crc.01

Greg, thanks for all your help with this but there is one item to clarify now
that I have tried this. The procedure works from the prospective of turning
the text box to required or "Cannot be blank". However, what I found during
implementation is the box continues to indicate an error with a red hashed
line around it even after a text entry is made. Am I missing some attribute
that is placed on the field related to my Data Validation check?
 
G

Greg Collins [InfoPath MVP]

Where is your check box bound to? A node in the main DOM or in a secondary DOM. InfoPath, in some areas, forgets to update things (don't recall which all areas, but custom validation might be one of them) when a secondary DOM is involved inthe condition.
 

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