This action changes a field value. It doesn't preform validation.

Testing method suggestion:
1. Create a custom link called 'Populate field' for story type.
2. Add different fields using CCK to story.
3. Create a wf_ng rule to 'populate a field'.

Testing should cover:
* Adding a value to a single field (single as in non-multiple).
* Adding a value to a multiple field with and without append.
* Clearing a node by leaving the 'Populate' empty on single and multiple fields.

Comments

amitaibu’s picture

StatusFileSize
new3.49 KB

oops, Forgot the token implementation... here it is.

amitaibu’s picture

BUMP :)

fago’s picture

Category: feature » task
Status: Needs review » Needs work

hm, this might be a mighty feature - so let's get it right.

* manually entering the field name is bad usability - provide a select box with all available fields. Perhaps with a note that only fields, that are really there in the later given node will work.
* I think this 'append' thing is too dangerous, as CCK doesn't do the handling of 'multiple' itself, but the field modules do. So each module treats this different, e.g. checkboxes and textfields. So probably it's best to leave this out for now.
* Setting the value of the field by simple string won't do it for many fields.
* Setting the value would ideally work like setting the default value in the CCK admin interface - use the native widget or for advanced users have php support. I'd be also ok with php support only. Of course we need to some help there at least like CCK does for the default value setting.

amitaibu’s picture

Status: Needs work » Needs review
StatusFileSize
new4.88 KB

Values can be entered by a PHP expression.

amitaibu’s picture

StatusFileSize
new4.21 KB

minor style issue

fago’s picture

Status: Needs review » Needs work
StatusFileSize
new4.35 KB

awesome, thanks! The validation of the values is great.

* I've fixed the typo in populate which was all over the patch!
* array_combine is php5 only, we need to make this php4 compatible.

apart from that, it's working great! I've attached the updated patch.

amitaibu’s picture

Do you want to completely remove array_combine, or create a php4 function for it?

fago’s picture

You can create a php4 function for it, as it's quite short:

function array_combine($arr1,$arr2) {
   $out = array();
   foreach($arr1 as $key1 => $value1)    {
    $out[$value1] = $arr2[$key1];
   }
   return $out;
} 
amitaibu’s picture

StatusFileSize
new5.08 KB

Added php4 function.

fago’s picture

Status: Needs work » Fixed

thanks. committed to 5.x-dev :) great!

Anonymous’s picture

Status: Fixed » Closed (fixed)

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