What do you mean by:
if the date completed field is updated
Does this mean that the field may already have a date and a different date was added at the time you need to check for empty fields? Or do you just mean that this field is not empty?
The date completed field will be empty. The trigger point will be when a date is inserted into this field.
One way is to open field options for Time Spent and set up this validation calculation:
I need to find the best way of ensuring that the time spent field is not empty if the date completed field is updated and the type selected is either Test 1 or Test 2.
( Not IsEmpty ( Self ) and Not IsEmpty ( DateCompleted ) and PatternCount ( "Test 1|Test 2" ; typeSelected ) ) or
IsEmpty ( DateCompleted ) or
Not PatternCount ( "Test 1|Test 2" ; typeSelected )
You may find that it's better to set up the OnObjectValidated script trigger to run a script that checks these values as this can allow you to produce a more user friendly response to the error and provide the user with better ways to correct the error than the standard options that appear with a validation error. from field options.