No matter what value I place in $node_field[0]['value'] the result is always 0 (zero).

Initially i did this: $node_field[0]['value'] = $node->field_position_pta[0]['nid']; field_position_pta is a node reference.
I then did this: $display = $node_field_item['value'].

Thinking i may have coded incorrectly i tried the following:

$node_field[0]['value'] = '25';
$node_field[0]['value'] = "25";

$node_field[0]['value'] = 25;

each and every time the result was still 0 (zero).

I then tried: $display = $node_field[0]['value']. But ended up with no value displayed at all.

I set data type to int and data length to 4.

I cleared the cache each time i changed the code.

Comments

Moonshine’s picture

Category: bug » support
Status: Active » Postponed (maintainer needs more info)

Not sure about this one but moving it to support request. Should probably try a newer release like beta3 or the new dev. Can also put some code in your field to help debugging like this at the end:

drupal_set_message("value:  " . $node_field[0]['value']); 
fatcheeks’s picture

Version: 6.x-1.0-beta2 » 6.x-1.0-beta5

Hi. I'm having the same issue as TomSherlock. I'm setting $node_field[0]['value'] to the node id and even changed the default value to something else other than 0, but those didn't have any effect.
Tried the debugging suggestion in #1 as well. Drupal just displays "value: " ($node_field[0]['value'] is blank).

How can I fix this? Any help is appreciated. Thanks

giorgosk’s picture

I have had the same problem just now
and I had to check "Store using the database settings below (required for Views use)" in the settings
admin/content/node-type/CONTENTTYPENAME/fields/field_FIELDNAME
and republish all the content that was using it
in admin/content

does that help ?

fatcheeks’s picture

I solved this by unchecking that option so that the value would be calculated on the fly during node load. It finally hit me when I read the handbook explanation on http://drupal.org/node/126522. Just in case anyone is facing the same problem, I'm quoting it here.

When is the field actually computed?

If you wish to store the values in the database then you have to update or re-submit the node to compute the value of the field.

If it is not stored in the database then the value computes when the node loads and only when the node is loaded. The field will not work in views nor will it function properly if it depends on other non-stored computed fields.

problue solutions’s picture

Im having this issue with "Store using the database settings below (required for Views use)" both checked and unchecked, nodes are updated, still displays nothing.

$node_field[0]['value'] = 'Testing';

$display = $node_field[0]['value'];

Nothing is displayed.

giorgosk’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

increase data length (available space to store value)