You ar enot supposed to change values in $node during validation. Instead, you can change $node->title during nodeapi(submit). That happens after validate and before node_save(). you can then skip the form_set_value() stuff and set directly on $node.

Comments

fago’s picture

Status: Active » Closed (won't fix)

yes, this was my first approach. But this won't work for node previews... so I see no way to change this. Furthermore I'm just using form_set_value() according to its documentation.

so I set it to won't fix.

moshe weitzman’s picture

Status: Closed (won't fix) » Active

i think nodeapi(prepare) is the way to do this for previews.

fago’s picture

Status: Active » Closed (won't fix)

hm
"prepare": The node is about to be shown on the add/edit form.

I'm not sure if this hook is intended to make value changes. However I think it would work to change $node->title there, but I can't get the necessary data at this stage. For getting the data I need the new fully built node object, and this isn't available there.
Furthermore CCK does its 'process form values' step first on validation. I need to access the $node object after this step, or things that use this like the date field will break.

moshe weitzman’s picture

ok ... perhaps add a code comment when you are next in there. will help others understand the decision.

fago’s picture

Title: Improper use of nodeapi(validate) » comment the use of nodeapi(validate)
Category: bug » task
Status: Closed (won't fix) » Active

ok, good idea

fago’s picture

Status: Active » Fixed

done

Anonymous’s picture

Status: Fixed » Closed (fixed)