hook_form_alter is simply misundestood. It does not mean "alter when the form gets shown". It means "alter when its build. And a preview with validation errors or a save with validation errors does not mean rebuild ( if it is a cached for though ).

To properly do this, use after_build which is called everytime the form gets shown (eventhough it is again called "build"... )

http://github.com/EugenMayer/wysiwyg_imageupload/blob/master/wysiwyg_ima...

And finally the implementation

http://github.com/EugenMayer/wysiwyg_imageupload/blob/master/wysiwyg_ima...

I guess the FAPI is far to complex and in that manner the workflow / flow of forms is pretty much undcoumented and has very odd edge cases.

Comments

adaddinsane’s picture

Version: » 6.x-1.0
Status: Active » Closed (fixed)

Yes, I completely agree, FAPI is not fully understood.

I work as a professional developer too - and I have used this module to fix situations in other modules. And provide a central method of loading JS and CSS files for me.

If people like it, they'll use it, if they don't they won't.