8 years ago
Topic

Hi,

I can't get value from groupX with Before Store.

The site is Joomla 3.5.1 with Seblod 3.8.1. I have a groupX with a Dynamic list selection and a Text zone. When I try to get Value from these items by calling a .php code with Before Store components, the value returned is null. If I open the forms, the items of groupX are correctly filled. Below Screenshot:

Form:

The Dynamic list of GrpX

My GroupX into the Form

Extract of PHP Code:

$formule = $fields['maformulecomposantes']->value;
dump($formule, 'Formule GRPX');
dump($formule[0], 'Formule 1');
dump($formule[1], 'Formule 2');
foreach( $formule as $frx) {

copy of "J!Dump"

Obviously the the loop foreach( $formule as $frx) {...   is unrecognized.

Please could you help me.

Thank you in advance

Get a Book for SEBLOD
4229 Posts
Kadministrator
8 years ago
2
Level 1

Did you place this beforestore field on the parent form or one the child?

8 years ago
1
Level 2

Hi,

  The Before store is on same form than the Groupx. The architecture of project is:

MyApp

    - Form1

    - Form2

    - ....

The BS components is on Site part of the form as below:

The Form is named "Les Formules". BS Conponents is port of this form:

8 years ago
0
Level 3

Hi,

   Is my last answer was that you did expect? In spite lot of test I don't understand from where the problem come. Have you needs of more information?

Thank you in advance.

Gérard

4229 Posts
Kadministrator
8 years ago
3
Level 1

$fields['maformulecomposantes']->value should be an array, when this is value from groupx field - no idea why it shows as integer in your dump.

8 years ago
2
Level 2

Hello,

 After lot of investigation, I have added exactly the same code called by "BeforeRender" into Content part of the form. In this case I have expected result,

$fields['maformulecomposantes']->value return the good array. If I call the same code from Site part of the form (during modification of article) , whatever if it is called by BeforeStore, AfterStore or BeforeRender $fields['maformulecomposantes']->value return an integer.

So in synthesis, if I call php code from Site part, $fields['maformulecomposantes']->value return an Integer

if I call same php code from Content part, $fields['maformulecomposantes']->value return expected array.

In addition I have restored a backup from similar functionnality developed with previous version of SEBLOD, I have no problem, BeforeStore work fine.

Thank you in advance

Gerard

4229 Posts
Kadministrator
8 years ago
1
Level 3

Hi,

I can confirm the problem.

As a workaround until this is fixed, you can get value like this: $config['post']['field_name'] - but take care that you make sure that value has expected content before you do anything with it, e.g. run it trough joomla input filter or cast it to e.g. int if it is an integer, and escape the value if you will insert it to the database yourself, especially if this is public form visited by anyone.

8 years ago
0
Level 4

Hi,

   Your workaround solution run well.

Thank you for your help, waiting next corrective patch from Seblod.

Gérard

Get a VIP membership