I'm developing a custom element for D6 FAPI (phone number, verified by SMS code), so I initially have a complex tree element with an input field and an ajax button to get the verification code.
I use this tutorial to make my button AHAH enabled "true way". Also I'd like to validate the phone at this step, so I have a function attached to textfield '#element_validate'. It works, and even more - if I enter wrong number, my textfield becomes red (having class 'error').
But the question is: how do I properly show the error message to user when the phone validation fails without page reload? And how can I prevent this message being displayed to user after page reload which will occur?