frontend form validation and ui logic