Lars,
I can't use "is_valid" as the check since it will return false even when I click OK, because in this case I'm having an inline spelling error. Instead, I can use "is_submission" as the check. It will return true when I click OK but not when an action button is clicked ...
Now I've detected a new problem, though. When the corrected text is submitted the element is updated with a null value (or "") ... Text that isn't spell-checked or that passes the spell-check without errors is updated correctly, however. In all other forms I've tested, this error is not seen.
Previously I've compared the spell-checking behavior in my script with that in bug.tcl, which (as opposed to mine) has worked fine. The only fundamental difference I spotted was that you're using the on_submit block in ad_form while I'm using the edit_request block ... I wonder if this comes into play here.
Now I find, however, that bug.tcl isn't working either - on the page where the spelling errors are shown the OK and Cancel buttons are missing. So I can't post the form and see if the corrected text is updated properly in bug-tracker.
I'll keep digging, but I'm beginning to go bonkers :-P
/Ola