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

curtaindog’s picture

Apologies, should have said that it is a cck option (single select) field.

webadpro’s picture

Version: 6.x-1.x-dev » 6.x-1.1

i'm having the same problem.

Has this been fixed?

YK85’s picture

I'm having the same problem.

FatherShawn’s picture

Version: 6.x-1.1 » 6.x-1.2

I'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.

OnlineWD™’s picture

Subscribing, 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.

OnlineWD™’s picture

Had a go with http://drupal.org/project/validation_api and succeeded.

jzornig’s picture

I'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

<select name="field_workflow_state[value]" class="form-select required" id="edit-field-workflow-state-value">
<option value="Draft">
<option value="Review">
<option value="Approval" selected="selected">
<option value="Approved">
<option value="Superseded">
</select>

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.

pbeakley’s picture

Subscribing.

This functionality continues to elude me -- I hadn't considered the possibility that maybe it's just a little buggy.

TripleEmcoder’s picture

You 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 ===

Encarte’s picture

Version: 6.x-1.2 » 6.x-1.4

Seems to be no way to pull a «True» result out of a «CCK single on/off checkbox» with a «Form element has value» condition.

TR’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)

Drupal 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.