Closed (fixed)
Project:
Drupal core
Version:
x.y.z
Component:
forms system
Priority:
Critical
Category:
Task
Assigned:
Reporter:
Created:
11 Feb 2006 at 09:30 UTC
Updated:
3 Mar 2006 at 11:01 UTC
Jump to comment: Most recent file
Very often it is asked for to inject elements depending on $_POST . Here is the possibility. Do not overuse!! Elements injected like this can not be form_alter'd . The patch also fixes the problem that the 'Need more choices' checkbox stays ticked.
A minor problem is that we had no good idea for the function name , thus the name form_foo . Better names are warmly welcome.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | poll_post.patch | 3.97 KB | chx |
| #5 | poll_6.patch | 3.5 KB | chx |
| #4 | poll_5.patch | 3.66 KB | chx |
| inject.patch | 5.06 KB | chx |
Comments
Comment #1
killes@www.drop.org commentedThe patch contains some cruft.
Comment #2
killes@www.drop.org commentedheh, that actually was supposed to be in there? I think somebody needs some sleep. :P
Anyway, the status is correct.
Comment #3
chx commentedSleep? We do not sleep in Vancouver :P anyways, I was sitting next to webchick and even she had no good idea for the name. And frankly, this patch needs a review -- if I set it to needs work (which is also true) noone will check whether it work.s The work neeeded is not a functional one, so we need someone to verify that poll works as intended.
Comment #4
chx commentedsimpler version
Comment #5
chx commentedComment #6
chx commentedI reviewed this quite enough. Why this needs to be in 4.7? First, to provide an example, that's why. Second, this is the way now things should be.
Comment #7
dries commentedIt makes for _less_ readable code. I don't like the fact that the forms API gets more and more obscure.
Comment #8
adrian commentedi agree with dries.
i still feel a '#multiple' keyword is the most readable solution.
You had the code almost working in that direction and then decided to rewrite it as this.
do you still have the previous revision from the coffee shop ?
Comment #9
chx commentedthe particular problem is that how we get the values for #title, #default_value, #value, #description, #dancing_pink_elephant for a particular element. the version Adrian references to used a callback to the original module which was supposed to do it... and now, as I come to think of it, I have another idea... let me cook something.
Comment #10
chx commentedThe patch builds the necessary fields in advance. When I mentioned this to Adrian he said "sounds quite clean".
If we call form_builder from other function then it's not internal. Thus I removed the underscore from it and added phpdocs.
Comment #11
dries commentedI like this patch better but leave the final review up to Adrian.
Comment #12
moshe weitzman commentedyes, extremely clean.
Comment #13
adrian commented+1
this is a very useful trick, and a way cleaner solution than anything else we have tried.
good work.
Comment #14
dries commentedCommitted to HEAD. Thanks.
Comment #15
(not verified) commented