javascript вариант,
<style>
.invalid {
color: red
}
</style>
Есть вот такой select
<select name="CanFrame_Type" id="CanFrame_Type">
<option value="Std" data-min-max="0-7FF">Std</option>
<option value="Ext" data-min-max="800-FFFFFFFF">Ext</option>
</select>
Далее поле для ввода НЕХ
<input id="Can_ID" name="Can_ID" size="5" class="max1" />
<script>
const select = document.getElementById('CanFrame_Type')
const input = document.getElementById('Can_ID')
const update = () => {
var [min, max] = select.options[select.options.selectedIndex].dataset.minMax.split('-')
var value = parseInt(input.value, 16)
if (value.toString(16) === input.value.toLowerCase() && value >= parseInt(min, 16) && value <= parseInt(max, 16)) {
input.classList.contains('invalid') && input.classList.remove('invalid')
} else !isNaN(value) && !input.classList.contains('invalid') && input.classList.add('invalid')
}
select.addEventListener('change', update)
input.addEventListener('input', update)
</script>