No Code Attached Yet J3 Issue
avatar ggppdk
ggppdk
29 Aug 2017

Steps to reproduce the issue

I will be making a PR next week or earlier for this
but i would like to here any comments that may be helpful
please read on

Problem:
Forms with large number of fields can not be posted properly
because a usual limitation for max number of form fields via
-- PHP max_input_vars setting (e.g. 1000)

Expected result

Joomla 's form JS

  1. counts (a rough estimation) the number of --active-- fields in the form
  2. and if they are close to 1000 (we can store current real limitation in a variable e.g. into Joomla.max_input_vars),
  3. then it serializes the form before it is posted
  4. and then it decompresses the form at server side

Actual result

The above is not implemented and large forms can not be saved

System information (as much as possible)

Systems with PHP max_input_vars limition (e.g. a value of 1000)

Additional comments

How to do it
-- inside Joomla.submitform we attach an extra submit event handler.

NOTE:

  • we cannot do it without --adding-- a submit event handler because the serialization will run before any event handlers that try to manipulate the form by listening to the submit event (thus they will not be able to see the fields (fields get disabled after serialization) , plus we will be wrongly posting field values before their processing by submit events has finished)
  • and then the above mentioned submit handler cannot be attached on page load !! because this will make it run before some of the other event handlers than are listening to the submit event, (and again the same problem that was mentioned above)

so it is needed that we both

  • do this work via a submit event handler
  • and we also register our serialization submit handler last!!

Process

  1. count active fields and continue with serialization only if close to limitation
  2. serialize only the active fields and store them in a single variable (sending inactive fields is wrong)
  3. disables all active fields
  4. at this point in the future we can add an AJAX submit handler, this must run after serialization (i am using this too already)

on Server side we need to decompress the posted data so that they are an exact match of the original form and are identical as if form has not been serialized

  • the process must restore multi-level array fields properly, even if they have some empty values

i have already written code that does the above without using eval,
but i am placing it at afterInitialize event, if anyone tries to read posted input before this then it will not be possible

  • so if someone has a better idea about an earlier place where to do decompression, please answer here
avatar ggppdk ggppdk - open - 29 Aug 2017
avatar joomla-cms-bot joomla-cms-bot - change - 29 Aug 2017
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 29 Aug 2017
avatar franz-wohlkoenig franz-wohlkoenig - change - 29 Aug 2017
Category Fields
avatar dgt41
dgt41 - comment - 29 Aug 2017

@ggppdk just a note that core.js is native javascript, so whatever you're planing to submit shouldn't depend on jQuery. Other than that your approach should be solid

avatar ggppdk
ggppdk - comment - 29 Aug 2017

@dgt41

aahh i am using jQuery,
maybe i can submit the PR and you code replacing the jQuery code ?

avatar dgt41
dgt41 - comment - 29 Aug 2017

@ggppdk George I think this might be handy: https://code.google.com/archive/p/form-serialize/downloads

But anyways, send your PR and let's take it from there

avatar franz-wohlkoenig franz-wohlkoenig - change - 30 Aug 2017
Status New Discussion
avatar ggppdk
ggppdk - comment - 30 Aug 2017

@dgt41

ok, thanks for the link, i found another alternative,
and it worked with little modification,

also i have removed all other jQuery code from the rest of my code

i ll use it for a few days and then make a PR

avatar ggppdk ggppdk - change - 31 Aug 2017
Title
[RFC] Implement serialization for forms with large number of fields
[RFC] Implement serialized submit for forms with large number of fields
avatar ggppdk ggppdk - edited - 31 Aug 2017
avatar ggppdk ggppdk - change - 31 Aug 2017
The description was changed
avatar ggppdk ggppdk - edited - 31 Aug 2017
avatar ggppdk ggppdk - change - 31 Aug 2017
The description was changed
avatar ggppdk ggppdk - edited - 31 Aug 2017
avatar ggppdk ggppdk - change - 31 Aug 2017
The description was changed
avatar ggppdk ggppdk - edited - 31 Aug 2017
avatar ggppdk ggppdk - change - 31 Aug 2017
The description was changed
avatar ggppdk ggppdk - edited - 31 Aug 2017
avatar ggppdk ggppdk - change - 31 Aug 2017
The description was changed
avatar ggppdk ggppdk - edited - 31 Aug 2017
avatar ggppdk ggppdk - change - 31 Aug 2017
The description was changed
avatar ggppdk ggppdk - edited - 31 Aug 2017
avatar ggppdk ggppdk - change - 31 Aug 2017
The description was changed
avatar ggppdk ggppdk - edited - 31 Aug 2017
avatar ggppdk ggppdk - change - 31 Aug 2017
The description was changed
avatar ggppdk ggppdk - edited - 31 Aug 2017
avatar brianteeman brianteeman - labeled - 25 Mar 2018
avatar joomla-cms-bot joomla-cms-bot - change - 25 Mar 2018
Labels Added: J3 Issue ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 25 Mar 2018
avatar franz-wohlkoenig franz-wohlkoenig - change - 20 Apr 2019
Title
[RFC] Implement serialized submit for forms with large number of fields
Implement serialized submit for forms with large number of fields
avatar franz-wohlkoenig franz-wohlkoenig - edited - 20 Apr 2019
avatar brianteeman
brianteeman - comment - 23 Aug 2022

Thank you for raising this issue.

Joomla 3 is now in security only mode with no further bug fixes or new features.

As this issue doesn't relate to Joomla 4 it will now been closed.

If we are mistaken and this does apply to Joomla 4 please open a new issue (and reference this one if you wish) with updated details for testing in Joomla 4.
cc @zero-24

avatar zero-24 zero-24 - change - 23 Aug 2022
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2022-08-23 22:33:25
Closed_By zero-24
Labels Added: ? No Code Attached Yet
Removed: ? ?
avatar zero-24 zero-24 - close - 23 Aug 2022
avatar joomla-cms-bot joomla-cms-bot - change - 23 Aug 2022
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - unlabeled - 23 Aug 2022

Add a Comment

Login with GitHub to post a comment