How to modify form fields before validation I have a custom content type with a lot of fields, and some are required. 
Under some circustances these required fields can be computed from other fields.
I tried to use also hook_node_validate, but i have always the error message because the field is empty when the user sends the form.
It's not easy to implement a javascript solution, since the algorithm to compute the values is not trivial. 
Which kind of solution do you suggest to use?
From the documentation:


  Note: Changes made to the $node object within your hook implementation will have no effect. The preferred method to change a node's content is to use hook_node_presave() instead. If it is really necessary to change the node at the validate stage, you can use form_set_value().