Hi, I am running latest version of D6.15 and trying to populate a numeric field with a number calculated from a computed field using rules. My issue is that my token doesn't fit in the field provided by the Rules UI. The token should read "[node:field_total-raw]", but only "[node:field_tot" fits in the field as shown in the attached image. I'm sure this is because of the field length, but am wondering if there is a workaround for this.

Thanks in advance for any assistance.

CommentFileSizeAuthor
capture.JPG9.67 KBfmesco

Comments

clarkburbidge’s picture

Component: User Interface » User interface

+1

I've got a datetime cck field that cuts off the end of my token.

mitchell’s picture

Status: Active » Postponed (maintainer needs more info)

Does this make the rule run improperly?

If not, you could use another text editor while you build it, then copy and paste it to the form.

grasmash’s picture

Status: Postponed (maintainer needs more info) » Active

No, you can't just paste it in. Drupal's built in validation realizes that it's longer than the maxlength for the input. There are actually a number of CCK validation issues that prevent the usage to tokens. I'll give you an example that's causing me trouble.

I have a required phone number field that needs a max length of 10 and field type 'digit.'

1) I can't paste a token into the field because the token in longer that 10 digits.
2) I can't paste a token into the field because the field value must be numeric. The token value will be a digit, but the token name cannot be accepted in the rules field.
3) I cannot leave the field empty and instead use PHP evaluation because the field is required.

This problem applies to any CCK field with pattern validation, such as website URLs and email addresses. I'd say it's a very large problem.

Is it possible to set these values using 'Execute a PHP script' rather than 'Populate a CCK Field' ? If so, what form must the return value take?

Thanks!

itangalo’s picture

Status: Active » Fixed

In the Rules Bonus Pack module, there is an action for populating CCK fields and bypassing both the input widget (for example select list) and field validation (for example numerical only). It allows you to set really weird values in CCK fields if you use it improperly, but it also allows you to use tokens without the problems described above.

Check out http://drupal.org/project/rb for more information.

Good luck!
//Johan Falk, NodeOne, Sweden
PS: I'm not maintaining the Rules module, just helping with support questions. You are welcome to ask more questions at http://groups.drupal.org/rules

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.