[development] Stupid forms/node API question

Ber Kessels ber at webschuur.com
Sat Dec 10 22:53:51 UTC 2005


Just another interested listener. I've ran into this same issue, asked on
#drupal and in this ML, but so far, no luck.
I've come to beleive its no longer possible, but please prove me wrong.

Ber

On Sat, December 10, 2005 23:18, Syscrusher wrote:
> I've been fighting this one for seven hours straight, and have read every
> bit
> of documentation I can find. I *know* I'm overlooking something really
> simple.
> Please help!
>
> Here's what I need to do in the edit handling of a custom node:
>
> 1. On initial entry to node/#/edit, I need to load values from the
> database
>    using hook_load() and stuff them into the $node object. This is working
>    perfectly, and the value from the databse loads into the visible form
> and
>    displays correctly.
>
> 2. When a preview is submitted, I need to take the value that comes from
> $_POST
>    and edit it before the form is generated. This is where things are
> breaking
>    down. I can "validate" the value, issuing errors if I don't like it,
> but I
>    can't seem to *change* it under programmatic control.
>
> I have tried changing $node->(my custom field) in nodeapi:validate, and in
> nodeapi:prepare, and even in hook_form. The thing is, I'm putting the
> modified
> value into the '#default_value' element of the appropriate part of $form,
> but
> somehow it's getting set back to the original $_POST contents from that
> field,
> between when I build the $form array and when that array is turned into
> HTML.
>
> I've been all over the code, but I can't seem to find where that's
> happening.
>
> Can someone help? Thanks!
>
> Scott
>
> --
> -------------------------------------------------------------------------------
> Scott Courtney     Drupal user name: "syscrusher"
> http://drupal.org/user/9184
> scott at 4th dot com       Drupal projects:
> http://drupal.org/project/user/9184
> Sandbox:
> http://cvs.drupal.org/viewcvs/drupal/contributions/sandbox/syscrusher
>


-- 




More information about the development mailing list