Rules Not accepting Integer Token

B4n7o - August 6, 2009 - 12:05
Project:Rules
Version:6.x-1.x-dev
Component:Rules Engine
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed
Description

I have two fields field_number_total
and field_number_unapproved
the unapproved value is a calculated field

then once the node is approved, the field_number_total must take on the value of field_number_unapproved

there is an option for the token, but the token does not fit in the field, there is also an option to use php, but im not that comfortable using it, as iv managed to break the db with the code iv tried.

#1

klausi - August 11, 2009 - 11:04
Status:active» postponed (maintainer needs more info)

What do you mean by "the node is approved"?
What event are you using in your rule?
What do you mean by "the token does not fit in the field"? It does not get replaced?
Are you sure this is related to the form support of Rules? Do you use any of the form events/actions?

#2

B4n7o - August 20, 2009 - 20:03

Sorry about this

I also have a field_approval which is a select list, options "yes" and "no"

then using views, i have these element all in a table, with field_approved as an editable field.

once you select yes as the approved option,

in rules
the event is
after updating existing content
then the condition is
field has value
then i select my "field_approval" field and select the "yes" option
so no the event will occur when "yes" is selected in the opproval field.

adding an action
"Populate a field"
select my "field_number_total"
and in there i want to use the token from my "field_number_unapproved"
the idea is to make the value of the total the value of the calculated field, once the the field_approval is selected.

here is where the issue is, you can use a token in this field, it asks for integers only, and you can only put 10 characters in the field, so it only writes the first few letters of the token anyway!

can you help with an alternative?

AttachmentSize
Screenshot.png 13.14 KB

#3

criz - August 23, 2009 - 12:59

Hi B4n7o,
I would suggest to use "Advanced: Specify the fields value with PHP code" in your "populate a field" rule.
It's not hard, try something like the following:

<?php
return array(
 
0 => array('value' => $node->field_number_unapproved[0]['value']),
);
?>

#4

criz - August 23, 2009 - 13:07

Although I faced simular space problems in other rules form fields. PHP execution is great, but the space for inserting more complex php code is often too limited. E.g. for going through an array variable per foreach (as used in multiple cck fields).

A little bit offtopic though...

#5

klausi - August 28, 2009 - 23:31
Component:Forms Support» Rules Engine

So this is not related to Rules forms support.

#6

fago - October 3, 2009 - 11:55
Status:postponed (maintainer needs more info)» fixed

#7

System Message - October 17, 2009 - 12:00
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.