[development] Stupid forms/node API question

Earl Dunovant prometheus6 at gmail.com
Sun Dec 11 01:12:02 UTC 2005


Please make note of this in the docs somewhere. I was just banging my head
against the same wall.

On 12/10/05, Karoly Negyesi <karoly at negyesi.net> wrote:
>
> On Sat, 10 Dec 2005 23:18:11 +0100, Syscrusher <scott at 4th.com> wrote:
>
> First. The subject is wrong, there are no stupid questions. We all learn.
>
> >    displays correctly.
>
> Good!
>
>
> > 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.
>
> Not good.
>
> > $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!
>
> Well, the actual value is calculated from $_POST['edit'] values and
> #default_value . If there is a _POST value, then it overwrites the
> #default_value .
>
> There are at least two solutions:
>
> a) You change $_POST
> b) You add a #value to the form element in this case. Have you read the
> documentation that you should never use #value? This is the exception.
> However, be extremely cautious what you set here, it'll be sent back to
> the user.
>
> Regards
>
> NK
>
> Ps. Ber, if I have not answered you, then sorry! I missed your letter.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20051211/b92a2d6b/attachment.htm


More information about the development mailing list