$data array does not contain radiobutton non-raw (label) values.

Bauer

Well-Known Member
Suddenly - since the last time I updated from github - last week - the $data array that is available to the php form plugin when the form is submitted no longer contains the labels for radiobuttons.

E.g. I have a radiobutton on an element named fb_generate___survey_style where one of the options was configured with the label 'Report' and the value 'report'.

I had some php code that checks
if ($data['fb_generate___survey_style'] == 'Report')
But that no longer works because now $data['fb_generate___survey_style'] is always empty.

The raw value, however, is correct. So I had to change the IF condition to
if ($data['fb_generate___survey_style_raw'] == 'report')

BTW - fb_generate is a joined table so any $data['fb_generate___element_name'] is from the (one and only) child record.

I may have fixed this problem, at least in this case - for this bug introduced with the last Fabrik update - but the real problem is that the $data array should also contain the label (not just the raw value) for radio buttons, like it used to.

I'm almost expecting to hear "I can't duplicate..." - but I thought I'd post this anyhow.
Happy New Year to all!
 
I can't replicate:D
I see the label in $data['table___element'][0] and the value in $data['table___element_raw'][0]

When do you run the php plugin (tested onBeforeStore and onAfterProcess)?
How is your join set up (id ->FK or FK->id)?
 
The PHP is configured to be run at "End of form submission (OnAfterProcess)"
The join is id to FK.

I have attached a cut of the relevant parts of print_r($data ,1) echoed to the screen.

Note that almost all the fb_generate elements do not show a value - even id and date_time; so it is not just an issue with radiobuttons as I initially thought.
The raw values are fine.

I only blamed the github update because it worked fine before that.
 

Attachments

  • fb_generate1.png
    fb_generate1.png
    83.1 KB · Views: 25
  • generate_raw.png
    generate_raw.png
    124.5 KB · Views: 27
I can't replicate either.

What other plugins are you running? I guess it's possible some other plugin is screwing up the data array.

-- hugh
 
I can't replicate either.

What other plugins are you running? I guess it's possible some other plugin is screwing up the data array.

-- hugh
The php plugin is the only form plugin I'm using.
There are 59 elements in the parent group (7 calcs, 11 dbjs, 1 cdd) and 20 elements in the joined group (4 calcs 4 dbjs). I suppose I could try to pinpoint if any particular element is causing havoc - but like i say, I know it used to provide the correct values because the php code that referenced them used to work.

Once I get both you and troester saying "I can't replicate", I know I'm in trouble.:eek:
 
Any calc elements? That's the only one I can think of off the top of my head that might modify the data array, as it does some nasty hacky stuff to pre-process the form data into placeholder readyness.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top