1283 Posts
Bucklash
8 years ago
Topic

Hi folks

I am using a GroupX field

I want to access the values of those fields using beforestore.

I have tried many things

Using gettype() I see that

gettype($fields['my_group_x'] is object
gettype($fields['my_group_x']->form is NULL


I have exhausted my options.

Any clever people know the way

Get a Book for SEBLOD
154 Posts
WebOne
8 years ago
1
Level 1

Hi Bucklash

Try this, it may work for you:

$value1a = $config['post']['groupxfield'][0]['Field1'];

$value2a = $config['post']['groupxfield'][0]['Field2'];

$value1b = $config['post']['groupxfield'][1]['Field1'];

....

1283 Posts
Bucklash
8 years ago
0
Level 2

Hi WebOne

Based on my initial efforts this morning it could just be that you are the messiah!!

4229 Posts
Kadministrator
8 years ago
5
Level 1

Since Seblod 3.10 there is values property added to fieldX/GroupX fields,  that holds data as array, eg-

$fields['myfieldX']->values = Array
(
  [0] => Array
  (
    [art_title] => asdasdas
    [group_x_field_with_storage] => sss
    [group_x_numeric] => 5
    [idforviewg] => 99
  )
)

Don't use $config['post'] as that contains raw, unfiltered data and this might be dangerous if you use value in e.g. some query

1283 Posts
Bucklash
8 years ago
4
Level 2

Hi Klas

Thanks for this little beauty - very much appreciated  :)

$fields['myfieldX']->values = Array

I will post a tutorial soon

Bucklash

143 Posts
Stef
4 years ago
3
Level 3

Hi Bucklash,

I did not find any tuto about 

$fields['myfieldX']->values = Array

Have you done One ? I'm still using the

$value1a = $config['post']['groupxfield'][0]['Field1'];

and it works well, but I wanted to know if there was anyway to do it better ?

Thanks for any advice ...

1283 Posts
Bucklash
4 years ago
2
Level 4

Hi Stef

Mi kinda decided groupx wasnt for me so never really used it in the end

Klas’s example not work for you?

143 Posts
Stef
4 years ago
1
Level 5

Hi Bucklash, actually it works well. The solution I use is :

$value1a = $config['post']['groupxfield'][0]['Field1'];Text

But the things is you mentionned the other solution as a "little beauty" and I wanted to know how to use it...

1283 Posts
Bucklash
4 years ago
0
Level 6

Hi

Not sure what you are unsure about... 

I guess I would just use it like this:

$somevalue = $fields['myfieldX']->values[0][‘somefield’];
	


Get a VIP membership