Quantcast
Channel: Recent posts across whole site
Viewing all articles
Browse latest Browse all 49199

CCK Fields Data in Titanium javascript

$
0
0

This is from Gregg's email .... I am moving here so it could be helpful for everyone

When I want to post info from a CCK text field called "field_origin" the services output looks like this

[field_origin] => Array
                 (
                     [0] => Array
                         (
                             [value] => Edmonton, Alberta, Canada
                         )

                 )

And when I use this Titanium code I get the full output of the array including brackets and the [value] text

var label2 = Ti.UI.createLabel({
text: data[c]['field_origin'],
color: '#420404',
});

How would I scope this javascript call to just a specific value of "value" within the array?

Similarly when I try and access this taxonomy field through services

[taxonomy] => Array (
                           [19] => stdClass Object (
                                            [tid] => 19
                                            [vid] => 2 
                                            [name] => Comedy 
                                            [description] => 
                                            [weight] => 0 )
                       )

using this code

var label2 = Ti.UI.createLabel({
text: data[c]['taxonomy'],
color: '#420404',
});

The output I receive is the contents of the array and not just the "name" field which is what I am looking for.

How would I scope this javascript call to just a specific value "name" within the array?


Viewing all articles
Browse latest Browse all 49199

Trending Articles