I'm trying to program a rule that only gets executed if a CCK text field has less than a certain amount of characters.
My idea was to add the condition "numeric comparison" to the rule, but i don't know how to extract the numer of characters from the CCK text field. (I'm using token, so in my case the name of the field is [node:field_text-raw].) I searched through the forum and documentation but couldn't find any help on that.
Does anybody have a suggestion/solution? Thanks.
Comments
Comment #1
amitaibuYou can use a PHP condition and
<?php return count($node->YOUR_FIELD_NAME[0]['value']) >= 1; ?>Comment #2
axel_exa commentedThanks for the quick reply. I didn't get it running, though. I activated the PHP module, defined a rule with a condition (truth value) and inserted the code
<?php return count($node->field_text[0]['value']) >= 5; ?>It always returns 1. I'm sure i'm missing something very obvious here.
Comment #3
axel_exa commentedI have it now: the trick was to use
strleninstead ofcount.