Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
I'm using the 'Form element has value' condition on building a node form. The code suggests that it falls back to checking the default value if it doesn't find an actual value which is exactly what I want but it doesn't work for a CCK (6.x-2.5) field. rules_forms_condition_element_value is in fact comparing 'Array ( [0] => X )' to 'Array ( [0] => Array ( [value] => X ) )'.
Cheers.
Comments
Comment #1
curtaindog CreditAttribution: curtaindog commentedApologies, should have said that it is a cck option (single select) field.
Comment #2
webadpro CreditAttribution: webadpro commentedi'm having the same problem.
Has this been fixed?
Comment #3
YK85 CreditAttribution: YK85 commentedI'm having the same problem.
Comment #4
FatherShawnI'm chiming here rather than creating a new issue because my error is similar and may be related. The differences are:
Version: We're using 6.1.2
Event: Form is being validated
CCK Text field widget: Radio button
"Form element has value" is set as a condition. The text from a single line in the CCK is cut and pasted into the condition's value field. When the form validates on a node set to match the condition, Rules reports:
2.154 ms Condition "Form element 'field_workflow' value check" evaluated to FALSE
Even though the values match and the rule should evaluate to True.
This rule tested properly during development so I believe that a recent update broke it and we missed that in our post-update testing.
Comment #5
OnlineWD™ CreditAttribution: OnlineWD™ commentedSubscribing, I know field ID is right because the show error message action works. Use field_driver_number[value] for ID and
101
for value. Node with this value for field_driver_number does not trigger error message action.
Comment #6
OnlineWD™ CreditAttribution: OnlineWD™ commentedHad a go with http://drupal.org/project/validation_api and succeeded.
Comment #7
jzornig CreditAttribution: jzornig commentedI'm trying to test the value in a cck textfield that is shown as a select list on the node edit form. I can't get a successful match.
field_workflow_state is a cck textfield with possible values (Draft, Review, Approved, etc)
It appears on the node edit form as follows
The element ids are shown as:
Element ID: group_workflow[field_workflow_state][value]
Element ID: group_workflow[field_workflow_state]
In my rule I create a condition that form element ID has value. I've tried both Element IDs and the value is Approval, but it always evaluates as FALSE
0 ms "Policy node form is being built" has been invoked.
0.088 ms Executing the rule "Workflow - Policy prevent Author edits in Approval, Approved, Superseded" on rule set "Policy node form is being built"
0.352 ms Condition "Form element workflow_state is Approval" evaluated to FALSE.
Comment #8
pbeakley CreditAttribution: pbeakley commentedSubscribing.
This functionality continues to elude me -- I hadn't considered the possibility that maybe it's just a little buggy.
Comment #9
TripleEmcoder CreditAttribution: TripleEmcoder commentedYou can it to work with single on/off fields this way:
- use field_name[value] as the field when checking condition
- enter 0 for the first field value (off)
- the second value works as expected (on)
- change comparison in rules_forms_condition_element_value() to be == instead of ===
Comment #10
Encarte CreditAttribution: Encarte commentedSeems to be no way to pull a «True» result out of a «CCK single on/off checkbox» with a «Form element has value» condition.
Comment #11
TR CreditAttribution: TR commentedDrupal 6 end of life was 24 Feb 2016. Drupal 6 and Rules 6.x-1.x are no longer supported as of that date, and no bugs with those versions will be investigated or fixed.
Rules Form Support is a separate module in Drupal 7. If this issue is still a problem in the Drupal 7 or Drupal 8 version of Rules Form Support, please open a new issue in that module's queue, with complete details of how to reproduce the bug.