Joomla 5 Notice

We are pleased to announce that as of January 29, 2024, all of our Joomla extensions are compatible with Joomla 5.

For all who are still updateing from Joomla 3 to Joomla 4: Joomla 4 Migration instructions are available here:

There is now a separate Documentation for Visforms for Joomla 4 and for Visforms for Joomla 5!

Forum

Visforms Subscription user can ask questions in our forum. Please log in with the relevant user first.
Everybody can access the forum for reading.

Please only ask 1 question per topic.

Important information for almost every question:
V1: Which Visforms version is running?
V2: Which Joomla version is running?
V3: Which PHP version is running?

413 error upon sending files above the limit

More
8 years 2 months ago #3493 by Jesus
Hi Aicha

I was doing some tests on the visforms form I've created on my wife's site, to see if all error messages were correctly translated and appear properly on the page (by the way, if you need a portuguese pt-PT translation, just ask, I've done it completely) and I found a situation that I'm not sure if it's visforms-related or not... but when I thought where to start looking at, I chose to come here and see the posts. Because no other user seems to have this problem, I've decided to ask for your assistance.

When I try to send a file above the limit set up on the form itself (5Mb), instead of a properly-rendered error message, I get a full white page with a 413 error, saying the following:

"Request Entity Too Large

The requested resource
/site/index.php/component/visforms/
does not allow request data with POST requests, or the amount of data provided in the request exceeds the capacity limit."

Following the error is a bunch of unreadable characters which gives the ideia to be the text-converted file, but don't really know. This happens regardless of the file extension, and wether the data is included in the result email or not.

This message is sensible to the limit set up on visforms. Once changed, it only appears when uploading files above the new limit.

For someone new to everything (Joomla, visforms and even site creation) it seems that visforms's error message is somehow overwritten by a Joomla! core component or other process that reacts to oversized file... or, visforms has a problem displaying this specific error.

I'm using Joomla! 3.6.2 and visforms 3.7.10. PHP version is 5.5.35. However, this issue has also happened on Joomla! 3.4.5 using visforms 3.5.7. After the updates on both Joomla! and visforms, the problem remains.

Can you please help me?

Kindest regards.

Mario Jesus

More
8 years 2 months ago #3496 by Administrator AV
Replied by Administrator AV on topic 413 error upon sending files above the limit
Hi Mario,

thanks for this post. I've already done some research about this just now (Google for "Request Entity Too Large" or "Error 413"), and it looks to me, that this is a bit more complicated.

Visforms itself catches all RuntimeExceptions which are thrown, if the upload fails. So this error is obviously not thrown as a RuntimeException and therefore not caught properly. Without further reading I cannot say, what to do about the problem. I will take a look into this, but it will have to wait until I have more time.

Regards,
Aicha

:idea: I recommend you the new and up-to-date documentation for Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/en/docs/
Most of this also applies retrospectively to Joomla 3.
Please only ask 1 question per topic :-).

:idea: Ich empfehle Dir die neue und aktuelle Dokumentation für Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/docs/
Das meiste gilt rückwirkend auch für Joomla 3.
Bitte immer nur 1 Frage pro Thema stellen :-).
The following user(s) said Thank You: Jesus

More
8 years 2 months ago #3498 by Jesus
Hi Aicha

Thank you so much for such a quick answer.

After my post I've done some investigations... and I found that my PHP error logs register every failed attempt to upload files above 8Mb. My host does not allow me to access PHP.ini, in which I could increase the "upload_max_filesize" and "post_max_size" values so that post messages above 8Mb could be accepted with no 413 error. What my host does is common practice among shared host servers.

I found that the error does not depend on the visforms filesize limit, I was wrong when I said it did. Because of this, visforms renders a correct error message above the form when the files is between 5Mb (limit configured in the form itself) and 8Mb (PHP limit). But if the file size plus all data in the form is greater than 8Mb, a 413 error is thrown. No extension exists to handle 413 errors.

As far as I could understand by reading some forums, PHP scripts are triggered after the post message reaches the server. If I understand this straight, visforms could avoid sending the message to the server if the file size overcomes the configured limit by performing previous check, probably using the plugin. If this could be done, I would never have a 413 error even with huge file sizes because visforms limit is below PHP limit. This might be an answer but I don't know if this makes sense from a developer point of view.

Does this help you anyway in a search for a solution?

Thank you again.

Kindest regards

Mario Jesus

More
8 years 2 months ago #3499 by Administrator AV
Replied by Administrator AV on topic 413 error upon sending files above the limit
Hi Mario,

thanks a lot for your research work., it'll help! You made a very good and clear summary of the facts and it all does make a lot of sense from the point of view of a developer.

It is always good to have some code examples which deal with the same problem. Therefore I would be interested in knowing, if the Joomla! media manager has some solution for the problem. But maybe it is not really a problem there, because with the media manager there are no other data submitted with the post so the file size and the total post size probably are the same.

So, thanks again a lot for your support. I'll try to devise a solutions as soon as possible.

I was provided with pt-BR translations for Visforms (including the translations necessary for Visforms up to version 3.5.1) but there are no translations available for pt-PT. So I would be interested in your pt-PT translations.

Thanks and kind regards,
Aicha

:idea: I recommend you the new and up-to-date documentation for Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/en/docs/
Most of this also applies retrospectively to Joomla 3.
Please only ask 1 question per topic :-).

:idea: Ich empfehle Dir die neue und aktuelle Dokumentation für Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/docs/
Das meiste gilt rückwirkend auch für Joomla 3.
Bitte immer nur 1 Frage pro Thema stellen :-).
The following user(s) said Thank You: Jesus

More
8 years 2 months ago - 8 years 2 months ago #3509 by Jesus
Hi Aicha.

Feeling truly glad here after reading your reply and also because I could help. Thank you!

This situation has revealed another thing that you might not be aware of, and that's why I'm using this reply instead of creating new topic.

I've figured out that every time the submission process results in an error (no matter which type of error is), the conditional fields are taken out from view when the page reloads. To be more specific, I have a multicheckbox or checkbox group field on my form. Depending on the option checked by the user, specific fields are shown below that checkbox group. If upon submission, and following page refresh, I receive some error messages, the form stays visible with the data inside the fields, but the conditional ones don't appear to the user, although the checkbox that triggered them stays selected. This creates an awkward feeling to the user because he/she thinks that those fields must be filled again, but at first glance they don't know how to, because the check box is selected and the fields are invisible. The user must uncheck and recheck again for the conditional fields to appear.

I had to put some text on the form to warn my users about the correct procedure in such an event. I guess Aicha follows me when I say this is something to be fixed, right?

I would say that it is simple to recreate this problem in a development environment as I guess all forms with such pattern will reveal the problem, but if necessary I cand send you my forms's URL.

Ok, so if I'm not asking too much (but I know I might...) I'm looking forward to a version that can prevent 413 errors in advance, and have no misterious "fields disappearings" upon errors ;)

pt-PT translatin will be sent for your email.

Kindest regards

Mario Jesus
Last edit: 8 years 2 months ago by Jesus. Reason: Words incorrectly written

More
8 years 2 months ago #3514 by Administrator AV
Replied by Administrator AV on topic 413 error upon sending files above the limit
Hi Mario,

could you please test if the following code changes fix the problem with the checkbox used to trigger conditional fields?

Open the file components\com_visforms\lib\field.php

Replace the function at line 179 - 191
Code:
protected function mendBooleanAttribs() { $attribs = array('required', 'readonly'); foreach ($attribs as $attrib) { $attribname = 'attribute_' . $attrib; if (isset($this->field->$attribname) && ($this->field->$attribname == 'required' || $this->field->$attribname == '1' || $this->field->$attribname == true)) { $this->field->$attribname = $attrib; } } }

with the following code
Code:
protected function mendBooleanAttribs() { $attribs = array('required' => 'required', 'readonly' => 'readonly', 'checked' => 'checked'); foreach ($attribs as $attrib => $value) { $attribname = 'attribute_' . $attrib; if (isset($this->field->$attribname) && ($this->field->$attribname == $attrib || $this->field->$attribname == '1' || $this->field->$attribname == true)) { $this->field->$attribname = $value; } } }

(Make a backup of the file before you make the changes in order to be able to go back if it does not work as expected).

Regards,
Aicha

:idea: I recommend you the new and up-to-date documentation for Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/en/docs/
Most of this also applies retrospectively to Joomla 3.
Please only ask 1 question per topic :-).

:idea: Ich empfehle Dir die neue und aktuelle Dokumentation für Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/docs/
Das meiste gilt rückwirkend auch für Joomla 3.
Bitte immer nur 1 Frage pro Thema stellen :-).
The following user(s) said Thank You: Jesus

Moderators: Administrator AVAdministrator IV
Powered by Kunena Forum