I have a cck file field "pic" users can attach up to 3 images to. I would like to set a Rule with the condition depending on whether user has uploaded at least one image or not.

I set the condition "Saved content's field 'field_pic' has value" + "negate" But no matter the field has a value or not (a file has been attached or not) the debug says "Condition "Updated content's field 'field_pic' has value" evaluated to FALSE."

I also tried this code below but again always the condition is FALSE.

return array(
  0 => array('fid' => 0, ),

How can I set the condition to check if the cck file field has at least one file or not?


I believe that "has value" needs to return TRUE or FALSE. You need to do the assessment yourself, because the value that it should have might not necessarily be a one or a zero (I would use this rule if I wanted to evaluate if a field has the value of 5, say: If yes, return true.)

You can either put in a value in the text input (5) which it will match for you and return true/false, or you can use PHP to evaluate it and return true or false yourself.

  • Thanks but I don't see any text input where I can put a value on Rules configuration page. Did you mean a condition other than "field has value"? – chinita7 Feb 27 '12 at 19:31
  • Switch to "direct input" in the rule config. – Renee Sep 12 '13 at 21:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.