You can do something like this:
$wire->addHookBefore('Inputfield::render', function(HookEvent $event) {
/** @var Inputfield $inputfield */
$inputfield = $event->object;
$process = $this->wire()->process;
// Return early if this is not ProcessPageEdit
if(!$process instanceof ProcessPageEdit) return;
// The page being edited
$page = $process->getPage();
// The field associated with the inputfield, if any
// Useful for when the inputfield is in a repeater, as the inputfield name will have a varying suffix
$field = $inputfield->hasField;
// The page that the inputfield belongs to
// Useful for identifying if the inputfield is in a repeater
$inputfield_page = $inputfield->hasPage;
// Return early if this is not a page we are targeting
if($page->template != 'test_combo') return;
// Do some check to identify the inputfield by name or field name
if($field && $field->name === 'text_1' && $inputfield_page->template == 'repeater_test_repeater') {
// Check some other field value if the message depends on it
if($page->test_combo->my_date === '2024-10-18 00:00:00') {
// Show an error message
$inputfield->error('This is a test error message');
}
}
// Do some check to identify the inputfield by name or field name
if($inputfield->name === 'test_combo_my_date') {
// Check some other field value if the message depends on it
if($page->test_repeater->first()->text_1 === 'hello') {
// Show an error message
$inputfield->error('Another test error message');
}
}
});