multipage form doesnt switch page (SOLVED)

Status
Not open for further replies.

creanet

New Member
Hi,

I have a multipage form (91) with 2 pages
On the 1st page 2 groups (367 & 369) but when I clic on continue the page doesn't switch on the last group (302 repeatable with pagination set to "both")
In the console I have : SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

What's weard is that this behaviour occurs only on certain webhost.

Could you please help me ?
 
Do you have a frontend menu item?
(If I call the form in the backend it's using a custom _tabs template with pagebreak in groups, which is incompatible).

It seems your site is using a lot of custom Fabrik templates.
Which may have to be adapted to the recent version.
 
It's a calc element (= your custom php code) throwing notices (and so breaking the expected JSON response)
<br />
<b>Notice</b>: Array to string conversion in <b>/home/toursinnei/www/plugins/fabrik_element/calc/calc.php</b> on line <b>204</b><br />
<br />
<b>Notice</b>: Array to string conversion in <b>/home/toursinnei/www/plugins/fabrik_element/calc/calc.php</b> on line <b>204</b><br />
<br />
<b>Notice</b>: Array to string conversion in <b>/home/toursinnei/www/plugins/fabrik_element/calc/calc.php</b> on line <b>204</b><br />
....

If you get an "unexpected character..." in browser's Console tab check the "Response" in the "Network" tab

As @cheesegrits says in your other thread:
I assume before the update Joomla error messages were off so you didn't see notices and warnings.
Additionally you may run a newer PHP version meanwhile and you custom code may be outdated at some places.
 
Last edited:
If I don't use pagination, the form is sent and I have this error message on the next form page
COM_FABRIK_EVAL_ERROR_USER_WARNING
Debug: Caught exception on eval in validation condition : syntax error, unexpected 'croisiere' (T_STRING)
 
Again, as I said on another thread, whenever you see an error on "eval", that means it's your code. In this case, as the message says, it's in the "Condition" on a validation.

I took a quick look at the elements for that form, and the first few I found that have validations (look at the Validations column, the x in x/y is the number of validations), has the Condition:

Code:
return {fk_devis___type_voyageur} != 0 || {fk_demandes___type_depart} != 2;

As I think I mentioned in one of my other replies, you should always quote placeholders, so you don't get invalid syntax.

Code:
return '{fk_devis___type_voyageur}' != 0 || '{fk_demandes___type_depart}' != 2;

So if one of those placeholders is the string "croisiere", without the quotes, the resulting code being run is ...

return croisiere != 0 || xyz != 2;

... which is invalid ("unexpected 'croisiere'"). String literals have to be quoted.

You'll need to check the rest of your validations, and make sure there aren't any more unquoted placeholders.

Also, make sure you use the _raw suffix for things like joins and dropdowns - any element that has the concept of a 'value' and a 'label', if you are comparing with a value. So for example if you have a dropdown with value '0' and label "No", and compare with 0, then use '{yourtable_yourelement_raw}' to get the value of 0, rather than the label of "No".
 
Yes. Along with any notices being thrown from calc code.

Basically, when you enable error reporting in J!, any warnings or notices being thrown in the code will break Javascript AJAX calls, ebcause (as Troester explained before), the error messages break the formatting of the server's response back to the JS. So if you turn error reporting off, it'll work.
But of course then you'll have undetected errors, in your code, which you'll never kn ow about till you do enable it.

<b>Notice</b>: Array to string conversion in <b>/home/toursinnei/www/plugins/fabrik_element/calc/calc.php</b> on line <b>204</b>

This one looks like an issue with Fabrik itself, not the calc code, and I think I have a fix on the copy of your site I have locally. But you need to let me know when you find all the validations that are throwing errors, so I can fix those here, and test pagination. I need to know the element names (or ids) you fix. I've been through some more here, but this form is so huge, with so many elements, I just don't have time. I've already put about 3 hours into fixing all these issues, which is waaaaay more than I can really afford to do on a subscription basis.

-- hugh
 
I fix the elements for both french and english form : 3973, 3985, 4584, 4762, 4763, 4764 and when I don't use pagination I have no more warnings
And all the "contenu_calc" + "objet_calc" elements (replace $formModel->data with $data but I don't think it's relevant in this case)
Even when I disable completly the error reporting in J! the pb with pagination is still there.
Thx again for your time and help
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top