PHP Code not saved

Status
Not open for further replies.
Just wanted to note this issue remains after updating to the latest GitHub. Enter code in a PHP Validation and save the element. Then go back to the PHP Validation and the code is gone.
 
The OP was for fabrik 3.1 and this is the fabrik 3.0 forum, did you post in the right place?
I tested in fabrik 3.1 and 3.0 and could successfuly save the PHP code for the validation rule. Do you get any js errors?
 
Sorry Rob, you are correct, I posted in the wrong forum. This is for Fabrik 3.1.

I do not see any JS errors. This is a copied radiobutton element. I tried entering the PHP Validation in both the original and copied version and still get the reported issue.

Here is the code I am trying to use:

PHP:
$last = '{mps_fargo_matches___last_status}';
return $last != 0;
 
I can't replicate this either, on 3.1.

http://screencast.com/t/99S0Ng0oxN

BTW, not really relevant at the moment as you can't save the code, but if you want to test your input as an integer, best to cast it to int, and do ...

PHP:
$last = (int) '{mps_fargo_matches___last_status}';
return $last !== 0;

Although note that this will also match an empty string. So if you ONLY want to match the literal 0, ...

PHP:
$last = '{mps_fargo_matches___last_status}';
return $last !== '0';

-- hugh
 
Hmm, well first of all thanks to both of you for checking and for the code suggestion! I need to get into the habit of casting variables. I will read up on what that extra = does in the expression.

Hugh, I noticed your test was a field element. Not sure if it matters but this is a copied radiobutton element. I tried entering the PHP Validation in both the original and copied version and still get the reported issue. I can't find it now but wasn't there a JS issue with radiobuttons recently?

I'm not sure how to proceed with this as it seems to go into the core of Fabrik, not so much just a element settings sort of thing. Despite sticking with a default/conservative setup as much as possible, my perception with with 3.1 is that certain things just get into a state where something doesn't work but it isn't reproducible for others. I realize that statement isn't helpful from a troubleshooting standpoint but is more an expression of frustration. :( OK, sorry for venting, back to the issue.

I am reluctant to delete and re-create the element as this element is fairly interconnected. It has worked for me in the past with other issues but doesn't address the source of the problem.
 
*friendly bump* the issue remains after updating from GitHub.

I can confirm the PHP code is saved properly on a field element as you show in your jing video Hugh.

I experimented a bit with a copy of my live site. First of all I completely removed the copied set of element just in case that had anything to do with it. I tried changing to a completely default dropdown element. I tried deleting and recreating the element.

Anyway, to make a long story shorter, this issue affects both the radiobutton and the dropdown element with the default settings. I just made a simple yes/no version with "return true;" as the PHP code.

I tried making a Jing video to illustrate but ran into issues with sign in. *sigh*
 
I am a little confused - the radiobutton and yesno do not seem to have a default box - at least not on my F3.1 install.

However I have tested the default on the dropdown element and can confirm that I have found the same issue on my install on both the Eval populate field and the default field.

It appears that the events which copy the edited text into the fields is not being fired on form save as it should. I am investigating.

S
 
I am a little confused - the radiobutton and yesno do not seem to have a default box - at least not on my F3.1 install.
Sorry for the confusion. All I meant was that I created a new radiobutton element and didn't change any settings other than to add yes, no as labels (and 0,1 as values) in the user presented options. There is a checkbox next to the label where you can define which option is selected by default.

It sounds like you have found the source of the problem however which is great news! Thank you for looking into this.
 
I have just submitted PR931 with a fix for the fabrikeditor / ace not saving php fields in dropdown.

As I type this I am told it has been merged and is now available for F3.1b on GitHub.

S
 
I have looked at radio-button and cannot reproduce the problem. If I check the default check-boxes, then my default is saved.

I did find a different bug - where you can set default on more than one selection, but I do not propose to fix that.

S
 
Are you saying that the radiobuttons default checkbox is not saved?
No, I was just trying to clarify my earlier post.:)

I have just submitted PR931 with a fix for the fabrikeditor / ace not saving php fields in dropdown.
From your description, it sounds like you have corrected the issue I reported. :) I will update and test.
 
Hi

I confirm that the php code cannot be saved in Validation.
I have a drop down element and tested it.
I have the today's github.

Thanks!
 
Again, I can't replicate this. Can you record a Jing video, starting with opening the element itself, so I can try and see any differences in your setup that night account for it?

-- hugh
 
After updating from GitHub, the issue has been resolved for me. :) Both dropdowns and radiobutton elements retain PHP Validation code when saved. Thank you!

dimoss, perhaps you downloaded from GitHub just before the fix was merged?
 
Hi

I updated again from Github today and I confirm that the PHP code validation is saved ok in the dropdown element.
Thanks!
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top