• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

trying to run PHP code for validation of csv file

Hello,

I am trying to run custom PHP code onBeforeProcess with a fabrik form. It is an file upload field and you are only allowed to upload 1 csv file. I am currently trying to throw a simple error message, but fabrik refuses to show those errors that I have defined with PHP:

$script = $formModel->getElementData('fabrik_file_upload___script');
if ($script == 1){
/* 1: repricing */
$formModel->errors['fabrik_file_upload___script'][] = 'error';
$formModel->getForm()->error = "csv not valid";
return false;
}
else {
$formModel->errors['fabrik_file_upload___script'][] = 'error';
$formModel->getForm()->error = "csv not valid";
return false;
}

I am getting the standard error message of a form at top and a small icon below the input field (file upload).

Is it possible to define $script and then require_once in order to include a PHP file, that can make use of the fields as variables?
 

Attachments

  • form-error.png
    form-error.png
    30.6 KB · Views: 135
Currently my form error messages are shown like this:

If there is a field in form with an error, I only see a little icon below the field.
When I hover this icon, I see my error message in a tool-tip.
The main error message on top does not show.

I am using a list module and I have Ajax active with form.

[1]

Wouldn't it be more convenient to print the error message inline (red) below the field and have a red border around the field with error?
Because just an icon to indicate an error is not intuitive in my opinion.
If there is an error, form should scroll top to show main error.
This way user knows, there are errorss in the form and they can check individual fields for an error.

Scroll Top is especially good for mobile.

[2]

What would be the correct path to my joomla root when I write a custom PHP Eval?
"../../../.."?

[3]

If I set "field_value = variable" with PHP Code, then include a PHP file, will I be able to use the field values with my PHP file?
I know I can include a PHP file with fabrik dropdown, but it says we can't use field values with our included file.

PHP onBeforeProcess
$script = $formModel->getElementData('fabrik_file_upload___script');

PHP file to include with onBeforeProcess after I have set variables
if ($script == 1){
/* 1: repricing */
$formModel->errors['fabrik_file_upload___script'][] = 'error';
$formModel->getForm()->error = "csv not valid";
return false;
}
else {
$formModel->errors['fabrik_file_upload___script'][] = 'error';
$formModel->getForm()->error = "csv not valid";
return false;
}
 
I have turned off Ajax with farbik list module.
Now I am getting the correct error messages.
But I am also getting a PHP error.

Why is that?
 

Attachments

  • fileupload.png
    fileupload.png
    39.9 KB · Views: 120
Also, it looks like I can't translate the specific error messages for fields. The main message does work. I might just go with the main error for now.
 

Attachments

  • fileupload-2.png
    fileupload-2.png
    38.4 KB · Views: 125
How do you set the fiels error message?

Gesendet von meinem SM-G930F mit Tapatalk
 
With PHP (Plugin) Code OnBeforeProcess with the Fabrik Form.

I am currently playing around to achieve the best possible outcome for errors, since I want my users to understand, what the error is.
I would like to perform a csv validation (maybe this could be added as a plugin later, since csv is used a lot.

I am using LABEL_ERROR and I have included those strings with admin and frontend language file (override).

For me as a user, it was kind of strang to see 2 different behaviours with error message (Ajax on/off).

With Ajax enabled in fabrik list module, the following won't work:

$formModel->errors['fabrik_file_upload___script'][] = 'error';
$formModel->getForm()->error = "csv not valid";

Also, as I said, a scroll to top error message (optional) would be great.
Users get confused (mobile), when they don't see the actual error.
They think, nothing is happening.

5:5 :)
 
With Ajax it doesn't reload the form but injects modifications via JS.

If you want to translate a lang string in php you must do something like
FText::('YOUR-STRING')
I'm not on my PC so have an extra look for the syntax

Gesendet von meinem SM-G930F mit Tapatalk
 
@troester

yep...you did it again. thank you. this code will work (ajax disabled with list module).

$script = $formModel->getElementData('fabrik_file_upload___script');
if ($script == 1){
/* 1: repricing */
$formModel->errors['fabrik_file_upload___file_upload'][] = JText::_( 'LABEL_ERROR' );

$formModel->getForm()->error = "LABEL_ERROR_FORM";
return false;
} else {
$formModel->errors['fabrik_file_upload___file_upload'][] = JText::_( 'LABEL_ERROR' );
$formModel->getForm()->error = "LABEL_ERROR_FORM";
return false;
}

I guess translation is not added yet with translation of field errors.
This will work for now :)

Thank you again.
 
Well, looks like it is working very nicely (see attached image).

There is only one little theme issue.

I have a fabrik list module and I have placed it inside a gridbox pagebuilder page.
I have one page for english and one page for german.

My fabrik list will show nicely with both sites, since the URL is assigned to a menu item.
Well, I have assigned the gridbox pages to the menu and inside the gridbox pages I have the fabrik list module.

It is working !

When I want to add a record, I am redirected to a system page, since there is no menu item attached to the form page.
This means, my theme won't work on the page with the form (see attached image 01 vs 02).

Source shows, there is some kind of additional menu injected:

<div class="ba-item-main-menu ba-item" id="item-15790813590">
<div class="ba-menu-wrapper ba-hamburger-menu ba-collapse-submenu">
<div class="main-menu">
<div class="close-menu"><i class="zmdi zmdi-close"></i></div>
<div class="integration-wrapper"></div>
</div>
<div class="open-menu"><i class="zmdi zmdi-menu"></i></div>
</div>

<div class="ba-menu-backdrop"></div>
</div>

This also means, I can't switch between german and english language on the fly.

I would try to go with Ajax for the fabrik list, but since the error messages only show in a tooltip and I can't place a main error, I have to disable Ajax.

The PHP error is gone.
Don't ask me why.
Probably due to some cache.
 

Attachments

  • 01.jpg
    01.jpg
    81.3 KB · Views: 109
  • 02.jpg
    02.jpg
    121.6 KB · Views: 112
you can add hidden menu items with your different languages

Gesendet von meinem SM-G930F mit Tapatalk
 
i tried that just 5min ago.

But how do I get those 2 URLs (redirect page to form from a fabrik list page) routed on a menu item?

de/component/fabrik/form/3/?Itemid=101
en/component/fabrik/form/3/?Itemid=101
 
well, i have assigned a menu item to a fabrik list instead of a gridbox page with fabrik list module inside.

I have the same gap at the top of my page, but the URL is different now for the form page:

de/upload-de/form/3/

will do some more testing.
 
if you could hint me at it, I would be thankful.

Since I have implemented a fabrik list module inside a gridbox page, everything is working.

When I want to add a recored, I get redirected (multi language):

de/component/fabrik/form/3/?Itemid=101
en/component/fabrik/form/3/?Itemid=101

Joomla can't make sense of those URLs when multi language is setup.
I am using one gridbox template for each language.
 
I'm not totally sure what you need. But you could e.g. add a redirect plugin with the language placeholder in the jump url or 2 redirect plugins with condition related to the used language

Gesendet von meinem SM-G930F mit Tapatalk
 
Ok, I will try to write a summary.
Issue might be template/fabrik related and I have the feeling I've been at this point before.

I am using Joomla Gridbox theme from Balbooa.
It is a page builder, similar to SP Page Builder.

Currently I am trying to get a fabrik list/form working.
I am having issues with the "add record" redirect page of a fabrik list.

Approach 1:

- I have a Joomla menu item, which will point to a Gridbox page
Gridbox allows to place modules, which is very nice

- I have placed a fabrik list module with Gridbox page
Fabrik list is working just fine inside Gridbox page.

Approach 2:

- I have a joomla menu item, which will simply point to fabrik list (not to a module)
Works, but...with this approach, I can't make use of Gridbox Page Builder

Approach 3:

- Trying to make use of Regularlabs Components Anywhere
It does work, but has some issues as well.

//=====

My main problem is the fact, that whenever I want to add a record to the fabrik list, I get redirected to a fabrik form page...

Looks like this:

index.php/de/upload-de =====> will redirect to a DE Gridbox page
index.php/en/upload-en =====> will redirect to a EN Gridbox page

With both gridbox pages I have placed a fabrik list module, as mentioned before.
Fabrik list does work!

When I want to add a record, I get redirected to:

index.php/de/component/fabrik/form/3/?Itemid=101
index.php/en/component/fabrik/form/3/?Itemid=101

Both pages start with...
<body class="com_fabrik form ">

Shouldn't they start with...
<body class="com_gridbox page ">

Well, this causes my page to have "little" issues with the theme.

I don't know how to deal with this.

When I activate Ajax with fabrik list module, there are problems with custom error messages.
Without Ajax, error messages show really nice.

Therefore I am forced to go without Ajax at this point.

I hope that Fabrik DEVs can come up with a simple solution for this.
Not sure if Gridbox can/will do anything here, since they have their own form builder and the redirect issue seems to be fabrik related.

Please Help :)

PS: willing to pay or become pro member for a working solution. I know I had this problem before, but has never been solved (i believe).

Source Fabrik List Page (has no issues)
Code:
    <script type="text/javascript" src="http://www.data2scrape.de/components/com_gridbox/libraries/modules/initItems.js?2.8.8"></script>
    <script type="text/javascript" src="http://www.data2scrape.de/components/com_gridbox/libraries/modules/initmenu.js?2.8.8"></script></head>
<body class="com_gridbox page ">
    <div class="ba-overlay"></div>
    <header class="header ">
        <div class="ba-wrapper">

Source Fabrik Form Page (has issues)
Code:
   <script type="text/javascript" src="http://www.example.de/components/com_gridbox/libraries/modules/initItems.js?2.8.8"></script>
   <script type="text/javascript" src="http://www.example.de/components/com_gridbox/libraries/modules/initmenu.js?2.8.8"></script></head>
<body class="com_fabrik form ">
    <div class="ba-overlay"></div>
    <header class="header ">
        <div class="ba-wrapper"
 
Well, I have managed to inject the component into a gridbox page with an almost perfect layout, using Regularlabs Component Anywhere.
Now the page will start with:

<body class="com_gridbox page ">

Header issues of tempalte are gone :)

[1]
I am using Regularlabs Components Anywhere with a simple Joomla text module e.g.:
{component index.php/de/component/fabrik/form/3/?Itemid=101}

[2]
Now I am using this module with Gridbox page.
I have linked a hidden joomla menu item to this gridbox page.

Result:

Looks good. But Fabrik seems to throw an empty error message, once page is loaded (see attached image).
I could remove this using CSS, but I would like to check alternative solutions for this (in case you got any good ideas on how to accomplish this) for a clean & working install.
 

Attachments

  • working.png
    working.png
    21.2 KB · Views: 122
Looks like a CSS rule for fabrik is missing:

Code:
.fabrikHide {
    display: none;
}

Will do some testing. Looks like this could be the solution.
Alternative solutions are welcome :)
 
It looks like this is a working solution for a fabrik list/form (without Ajax).

1. Create Gridbox page and point menu item to it (hidden menu).
2. Include component with a Custom Joomla module, using Regularlabs Components Anywhere.
3. Import module into Gridbox page
4. Add additional CSS to hide Fabrik Error Message

Code:
/* hide */
.fabrikHide {
   display: none;
}

Finally I need to redirect.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top