It definitely needs reworking. But my problem is, on preview it goes:

1 - execute amazon_form(&$node)
2 - execute amazon_node_form_validate($form_id, &$form_values) with NO access to $node
3 - execute amazon_view($node) with NO access to $form_values
4 - execute amazon_node_form_validate($form_id, &$form_values) AGAIN, with NO access to $node

I suppose I could toss a copy of $form_values into a global variable but that's something I actively try to avoid, to make debugging easier.

Once I figure this out, I'll work with you on your filter.

On 1/6/06, Jeff Eaton <jeff@viapositiva.net> wrote:
I noticed that a lot of the heavy lifting for the moduel is done in validate, including the actual population of the node object with the amazon item information. The only thing I can think of off the top of my head is to:
 
Retrieve the amazon data from scratch whenever a preview is built, based on the known ASIN value. use the 'Validate' hook to establish whether the asin(s) are valid but do NOT save, then retrieve the amazon data again and actually save it on submit. It would entail more round-trips to amazon, but it would work cleanly unless I'm missing something. Anyone? Thoughts? Corrections? Maybe you're already past that point and I'm just echoing. :)
 
Validate did a LOT of heavy lifting in the old forms system, and that's been reduced with the new api. It requires reworking some steps in more complicated modules.
 
--Jeff
-----Original Message-----
From: Earl Dunovant [mailto:prometheus6@gmail.com]
Sent: Friday, January 06, 2006 4:31 PM
To: development@drupal.org
Subject: Re: [development] update hooks/APIs documentation

My current task is figuring out how to properly do the preview when the form is built BEFORE validation or or submit hooks are invoked and neither hook has access to the node object, nor do the node validation, insert and update hooks have access to the form object. And this is my first look at image.module, which is suggested as an example.

It's weird...I had less problems with the bulk import form.