Typically we enforce validation on a form by putting the "Read Only If" value of the submit button to:
/task is not valid
However, the system generally ignores read-only fields when doing its validation check. For example, let's imagine a form where a manager's approval is needed. We want to ensure that the manager information is valid, so we use a directory lookup and populate a read-only row to show the manager's information.
Since the row of data is read-only, the submit button would normally let you click it even though you didn't pick a manager - despite the field being required! So the trick to getting around this issue is simple. On your submit button we need to look for TWO validation conditions. Is the form in an invalid() status AND does the manager's name have a value. In order to do further validation, you will have to create a custom section in your application with two buttons. You can use the section from the toolkit as a model when creating it. The updated expression on the Read Only If property would look something like this:
(/task is not valid) or (managerId does not have a value)
You might think you would put an AND between conditions those instead of an OR, but remember that in general if all the required fields are complete then the invalid() check is going to be true. So once all the required fields are checked, the second condition is evaluated and if we've actually picked a real manager from the directory this will have a value and pass.