<form action="">
    <input pattern="[A-Z]+">
    <button type="submit">submit</button>
</form>
<style>
  input:valid { background-color: green; }
</style>