Closed (fixed)
Project:
Rules
Version:
6.x-1.x-dev
Component:
Forms Support
Priority:
Normal
Category:
Feature request
Assigned:
Issue tags:
Reporter:
Created:
3 Aug 2009 at 15:39 UTC
Updated:
3 Jan 2014 at 00:29 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
amitaibuMove the code after the previous action, and call #after_build only once.
Comment #2
amitaibuHad a typo...
Comment #3
markus_petrux commentedUgh, I think this is not something I would like to see in CCK package. The trick I documented in the handbook could not work for all form elements, it may need slight variations, and this would mean a can of worms that's not desired in CCK due to the huge user base.
Maybe you could write this as a contrib module?
Comment #4
klausiBringing this back home to Rules Forms.
I think you should do it in a more generic way - make it possible to disable *all* form elements, like it is possible to hide all types of form elements. Do a patch for rules_forms.rules.inc and add your action there.
Comment #5
amitaibuWell, the thing is that disabling a CCK field isn't working the same as FAPI, that's why I thought of that patch.
Comment #6
amitaibuAnd here it is...
Comment #7
klausiGood, the period in "Disable an element of the form." is a little bit annoying, please remove it.
Apart from that the patch looks clean and works for me.
Regarding CCK: have a look at rules_forms_action_adjust_weight(), we already do a small CCK hack there, so maybe it works in a similar way for disabling fields?
Comment #8
amitaibuYeah, I saw the CCK hack, but it won't do for disabling. As you can see in http://drupal.org/node/357328 - there no real straightforward way of doing it. I assume It will be solved in D7 when we'll have fields in core.
Comment #9
klausiThanks, committed to CVS.
Now we should think about the ugly CCK stuff ... do we want this also in the Rules Forms module?
Setting the issue back to active.
Comment #10
klausiAnd here comes the support for CCK fields and other form elements that are not known during hook_form_alter() yet.
The patch also improves the element ID annotations on forms ("Container" form elements are not called "Hidden" anymore).
Comment #11
amitaibuMarkus wrote:
> The trick I documented in the handbook could not work for all form elements
So even if we use it maybe it's worth mentioning in the description some kind of warning. Although we can ask markus to explain when his 'trick' will not work.
Comment #12
klausiNew patch: Removed "Note that this will not disable CCK fields" from the description.
If you look at form_builder() and _form_builder_handle_input_element()
http://api.drupal.org/api/function/form_builder/6
http://api.drupal.org/api/function/_form_builder_handle_input_element/6
you see that disabled elements are expanded in the same way as we do:
So we can assume that this will work for all form elements for now.
Comment #13
amitaibuSeems ready to be committed.
Comment #14
fagoI think so too :)
Comment #15
klausicommitted to CVS.