• A new version of Full Calendar is now available.

    See the details here

ERROR / ISSUE in next page in multi page Form.

ayito

New Member
Hello and first things first, thanks for this great project.
Data:
  • Joomla:
    • Joomla 5.1.0 updated from a clean installation of Joomla 5.0
    • Cassiopeia Template
    • Fabrik 4.0 plus the updated file from github for J!5.1 as stated in the sticky announcement on top of forum.
Issue:
A multi page Form that doesn't go "next" page when pressed the "Next" button (obvious). Here are the details:
I set up a List / Form with several groups (and elements) with Page Break.
When everything is set up I try the Form on my front page in two ways, both with issues:
  • Option 1: New Menu entry of type Fabrik > Form, resulting in a Link:
    • index.php?option=com_fabrik&view=form&formid=4
    • This menu entry has another menu entry as Parent Item, lets call it: "parentmenu"
    • When I go this and click on Next button I get the next error in the Firefox console (time 09:23:38.851):
    • XHR POST https://domain.com/parentmenu/index.php?option=com_fabrik&format=raw&task=form.ajax_validate&form_id=4
      • 404 Not Found
    • My guess is that parentmenu should not be there.
    • So then I try to put the menu with no parent.
    • After some time (time 09:28:15.389) I also get:
    • XHR POST https://domain.com/component/ajax/?format=json
    • 403 Forbidden
  • Option 1b: So I try to place and save the menu with "No parent", so it's first level in the main menu, same test, I click on Next button and this is what I get in the Firefox console (time : 09:33:30.153):
    • Uncaught SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
    • form.js:723:30 (SyntaxError: JSON.parse: bad parsing)
    • I'm also get this warning:
      • Error en el mapeo fuente: request failed with status 404
        URL del recurso: null
        URL del mapa fuente: installHook.js.map
    • And also some time later:
  • Option 2: I place the form inside an article via "{fabrik view=form id=4}" and then the menu will be of single article type, check if this make any difference. I get same results as with option 1a and 1b.
So, it seems that the link is "404 Not Found" when placed in a submenu, this I will definitely appreciate some guidance and solution. Then, there's a second issue with the syntaxError JSON.parse, two notes:
  • I haven't placed any Validations on any elements, so no validation.
  • First group only had a checkbox (with no validation) and ready to go Next to the second group.
  • In the Form options, Form processing I have Ajax validation to "No".
Thanks for your time reading this, if you need more info about the set up or data collected just ask.
 
I can't replicate.
With a parent menu (and SEF on) the URL is https://domain.com/parentmenu/index.php?option=com_fabrik&format=raw&task=form.ajax_validate&form_id=4
and while going to "Next" Fabrik is validating the elements
So this URL is correct.

Any warning, error etc. will break the expected JSON, have a look at your browser's Network tab (Preview, Response) to see what is returned.
This doesn't look like coming from Fabrik (but it may break the "Next")
What is installHook.js.map?

Try to disable all your additional components and plugins.
 
Thanks for your response
  • I neither know what this is installHook.js.map, but hthis happens after and doesn't seem releated.
I have also tried this:
  • with Debug System Yes in Joomla Global Configuration > System
  • I see the eventin:
    • <form method="post" class="fabrikForm" name="form_4" id="form_4" enctype="multipart/form-data">
    • event click https://domain.com/media/com_fabrik/form.js
    • function(e) {
      self._doPageNav(e, 1);
      }
  • So I can go and modify the function to alter the url to go up one level and bypass the parentmenu issue in the url.
  • In: _doPageNav: function(e, dir) (modified / add lines 701 to 706)
  • // I change the url only for my form with id 4.
if (this.id === 4) {
url = '../index.php?option=com_fabrik&format=raw&task=form.ajax_validate&form_id=' + this.id;

} else {
url = 'index.php?option=com_fabrik&format=raw&task=form.ajax_validate&form_id=' + this.id;
}
So now I get that the url is working and this is the result:
POST https://domain.com/index.php?option=com_fabrik&format=raw&task=form.ajax_validate&form_id=4

and no parentmenu in the url.
---
with Debug System set to No in Joomla Global Configuration > System

The event click in the form reads the dist file:
event click https://domain.com/media/com_fabrik/js/dist/form.js
and the previous change while in debug system set to yes doesn't take place.

I've also seen that then it's passed to jQuery.ajax :

About disabling "Try to disable all your additional components and plugins." what exactly do you mean? there's lots of them in joomla.

As of right know, I am going to try to replicate it in a clean installation, since you mention you haven't been able to do it,
 
what exactly do you mean? there's lots of them in joomla.
Not in a clean J! installation. Additional components, plugins, frameworks are those you added or you got by eg. installing a complete "quickstart" template or framework package
event click https://domain.com/media/com_fabrik/js/dist/form.js
and the previous change while in debug system set to yes doesn't take place.
Fabrik compressed JS files (in /dist or named -min.js are run as long as you don't set "Debug JS" in Fabrik Options.

As I said: I can't replicate.

Make sure you have no additional plugins and components overriding original J! or Fabrik JS.
Make sure you don't get any errors/warnings/notices breaking JSON responses (resp. look at them in your browser's network responses).
Test the Fabrik form in the backend.
Turn SEF off.
Make sure your files/folders are accessible, no .htaccess preventing access or re-directing etc.
 
This happening to me too.
Clean install of Joomla 5.1 or 5.1.1
Clean install of Fabrik 4.1 (no other patches installed)
Joomla SEF Settings ( use SEF URL = Yes, use URL Rewrites = Yes, add suffix to URL ending = Yes)
Fabrik Form created with 4 elements (no extra plugins and no JS validation created)
Each Group with 2 elements created
Multipage setup done.

1. www.mypage.com/form2.html
Menu item 1. level created and pointed to Fabrik Form 2 (Form Multipage works well - no errors)

2. www.mypage.com/db/form2.html
Menu item 2. level created and pointed to Fabrik Form 2 (On first form page when click next, it shows me loading icon in progress)

If i deactivate Joomla SEF Settings, form works on booth menu levels.

htacces file has no redirects
#Options +FollowSymlinks
#Options -Indexes
RewriteEngine On
RewriteBase /

If try to open the copied non SEF URL (index.php?option=com_fabrik&view=form&formid=2&Itemid=114) on a SEF turned On site, than the form is working booth as decribed on point 1 & 2.

Did the backend Form Menu Item Setting missing the (Itemid=114) value?
Because under Joomla Menu > Details > Link
show me without the Itemid> (index.php?option=com_fabrik&view=form&formid=2)
 
This happening to me too.
Clean install of Joomla 5.1 or 5.1.1
Clean install of Fabrik 4.1 (no other patches installed)
Joomla SEF Settings ( use SEF URL = Yes, use URL Rewrites = Yes, add suffix to URL ending = Yes)
Fabrik Form created with 4 elements (no extra plugins and no JS validation created)
Each Group with 2 elements created
Multipage setup done.

1. www.mypage.com/form2.html
Menu item 1. level created and pointed to Fabrik Form 2 (Form Multipage works well - no errors)

2. www.mypage.com/db/form2.html
Menu item 2. level created and pointed to Fabrik Form 2 (On first form page when click next, it shows me loading icon in progress)

If i deactivate Joomla SEF Settings, form works on booth menu levels.

htacces file has no redirects
#Options +FollowSymlinks
#Options -Indexes
RewriteEngine On
RewriteBase /

If try to open the copied non SEF URL (index.php?option=com_fabrik&view=form&formid=2&Itemid=114) on a SEF turned On site, than the form is working booth as decribed on point 1 & 2.

Did the backend Form Menu Item Setting missing the (Itemid=114) value?
Because under Joomla Menu > Details > Link
show me without the Itemid> (index.php?option=com_fabrik&view=form&formid=2)

Thanks for replying and also confirming this beahaviour (so I'm not feeling that crazy, lol). To be honest, I did try myself to replicate it in my local computer, I used the docker image for it and did a clean installation. I couldn't replicate it! So what I decided to do was to have this recently clean installation and uploaded it to the production site, it was quite intesting process since I had to move users, content, categories, articles, menus and all fabrik data/tables lists, elements, etc... to the new installation. So I moved quit a bit of data using mysql with phpmyadmin and also some manual configuration also.

And I got back to square one, just as you describe. I haven't been able to dedicate much time to it and also I'm not a seasoned PHP, Javascript programmer.

But I did this workaround the issue. I configure a hidden menu that it sits at top level, then I link to that menu from an article (or module or other menu entry...) so whenever I go to that form the root url is not in a submenu and I don't get that issue.

I'll be keeping track of this thread and whenever I have the time I'll do more research. As of right now I think it must have something to do with the htaccess or the php environment, can't tweak with the php.ini in the production server, though I'll compare phpinfo from the server and from local environment and check if I see something there.

Thanks for participating.
 
So when you both get the spinning loader (obviously not always):
Can you check in your browser's Network tab for the message breaking the expected JS network response and so creating the spinner (resp. preventing the loading of the next page)?
 
Is your menu default "Home" accessible?
There may be issues if e.g. the "Home" is only accessible for "Guest", not for "Registered" etc.
 
Ok, so you have not only SEF enabled but also URL rewriting?
Replicatable in this case.
 
Ever since I updated to Fabrik 4.2 (last week) from 4.0 (zeta), I'm having the same issue as mentioned above. It appears to be caused from having SEF enabled as others have mentioned (so it is only applicable to the site/front-end access to the forms and not an issue with accessing a form from the administrator end of the site). I have a multi-page form that opens fine initially, but when I click "Next" to proceed to the next group of form elements, an action is triggered (ajax request to the task "form.ajax_validate") and fails because the url that the ajax request is being sent to includes the SEF path info (instead of stripping it). For example an SEF menu path like this: https://mysite.com/menu-level1/menu...format=raw&task=form.ajax_validate&form_id=22, will fail.

If I turn off SEF, the form goes to the next group of elements without issue because the ajax script can get to: https://mysite.com/index.php?option=com_fabrik&format=raw&task=form.ajax_validate&form_id=22. I can't seem to find where the url for the ajax request is set in the scripts (or how to disable the validation).
 
Last edited:
This didn't fix the issue unfortunately. It worked fine with Fabrik 4.0(zeta) and Joomla 4.4.6. I updated to Fabrik 4.2 on July 19th and then the issue started. When I click "Next" on a multi-page form (from the initial group of elements), a validation script runs and makes an ajax call to https://mysite.com/menu-level1/menu...format=raw&task=form.ajax_validate&form_id=22 (in this case, the id of my form is 22). I don't beleive it is an issue with the router.php file since applying the suggested update to the router.php file from the thread you had provided, didn't fix things. I tried replacing the script in the router.php file with what was in the 4.0(zeta) copy and it didn't fix it either...

I do have SEF and URL Rewriting turned on, but have Add Suffix turned off. I can confirm that if I turn off SEF and URL Rewriting, the issue goes away, but I need both on for my site.

If someone could point me to where the validation script gets the url for the ajax request, I could check into things a little more. I've been looking around, but can't find what where it is...

Thanks


Travis
 
Last edited:
This didn't fix the issue unfortunately. It worked fine with Fabrik 4.0(zeta) and Joomla 4.4.6. I updated to Fabrik 4.2 on July 19th and then the issue started. When I click "Next" on a multi-page form (from the initial group of elements), a validation script runs and makes an ajax call to https://mysite.com/menu-level1/menu...format=raw&task=form.ajax_validate&form_id=22 (in this case, the id of my form is 22). I don't beleive it is an issue with the router.php file since applying the suggested update to the router.php file from the thread you had provided, didn't fix things. I tried replacing the script in the router.php file with what was in the 4.0(zeta) copy and it didn't fix it either...

I do have SEF and URL Rewriting turned on, but have Add Suffix turned off. I can confirm that if I turn off SEF and URL Rewriting, the issue goes away, but I need both on for my site.

If someone could point me to where the validation script gets the url for the ajax request, I could check into things a little more. I've been looking around, but can't find what where it is...

Thanks


Travis
*** Update to above ***

I'm sure this is a terrible hack, but my fix is one of two options:

1. I edited line 700 in media/com_fabrik/js/form.js. I modified the value for the variable "url"

from: url = 'index.php?option=com_fabrik&format=raw&task=form.ajax_validate&form_id=' + this.id;

to: url = window.location.origin + '/index.php?option=com_fabrik&format=raw&task=form.ajax_validate&form_id=' + this.id;.

I then renamed media/com_fabrik/js/dist/form.js to form_orig.js and copied the form.js file from media/com_fabrik/js/ to the media/com_fabrik/js/dist/ folder (not js "minified", just needed to test...).
Basically, I'm forcing the url to strip out the aliases that the menu creates (the SEF).

2. The other option I tried (and also works) was to add a rewrite rule. I'm using Nginx rather than Apache (side note: the suggestion to add the Conditional Rewrite rule noted in router.php
RewriteCond %{REQUEST_URI} (/|\.csv|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$ [NC], isn't Nginx friendly...).

Neither option is ideal, but option 1 will be an issue when the next version of Fabrik comes out (and I'll have to remember to replace line 700 again...), so I've implemented option 2.

Oddly though, form.js in Fabrik 4.0(zeta) is the same as Fabrik 4.2 (the script handling multi-page forms), but it worked, so there must be some other script "somewhere" else that "cleans" up the url. Maybe it was the update from Joomla 4.4.4 to 4.4.6 that changed something and I just didn't notice the issue until after I updated Fabrik?

Anywho... thought I'd share. Also, I'm wondering if the people who've had this issue were using Nginx or Apache... Maybe there is some kind of universal rewrite rule I could use that I haven't found/thought of...
 
Back
Top