[development] losing value somewhere after validate.

Sammy Spets sammys-drupal at synerger.com
Fri Jun 16 03:59:48 UTC 2006


Sime,

You can modify form values during the validate phase by using 
form_set_value().

See http://api.drupal.org/api/4.7/function/form_set_value

Cheers,

-- 
Sammy Spets
Synerger Pty Ltd
http://www.synerger.com/

On 16-Jun-06 01:33, sime wrote:
> OK, I found the document that describes differences between 4.6 and 4.6. 
> It states that I cannot change a value on validation.*
> 
> *http://drupal.org/node/22218
> 3. validate (you can only validate here, no changes possible)
> 
> 
> This conflicts with the nodeapi docs:
> 
> http://api.drupal.org/api/HEAD/function/hook_nodeapi
> "validate": ... This hook can be used to check or even modify the node
> 
> 
> Should I assume that the first one is correct? This would mean that I am 
> just encountering legacy 4.6 code in ecommerce 4.7. Sorry, I'm finding 
> this hard to get my head around.
> 
> .s
> 
> 
> 
> sime wrote:
> 
> >Hello.
> >
> >I keep losing values that I modify in the 'validate' op of 
> >hook_nodeapi(). This occurs by the time I get to the insert or update 
> >ops.
> >
> >It has to be something simple I am overlooking. I normally wouldn't 
> >hassle the list over such things, but I am starting to write bad code 
> >to compensate, so I need to work out what I'm doing wrong. It is a 
> >little hard for me to track the $node through core, so are there any 
> >suggestions about what I might be doing wrong, or where a problem like 
> >this can arise?
> >
> >Kind thanks for any advice.
> >Simon
> >
> >PS.
> >I have checked the nodeapi docs:
> >"validate": The user has just finished editing the node and is trying 
> >to preview or submit it. This hook can be used to check or *even 
> >modify the node*.
> >
> >Also, I have double-checked that i am using a version of form.inc that 
> >is after this issue was fixed: http://drupal.org/node/63704
> >
> >
> >


More information about the development mailing list