stefangabos / Zebra_Form

A jQuery augmented PHP library for creating secure HTML forms and validating them easily
Other
98 stars 49 forks source link

slow to load (6-10 seconds in zebra_form.js ) #23

Open JeffBuckles opened 8 years ago

JeffBuckles commented 8 years ago

I have a page with almost 800 controls -- it's a list editor as shown in the attachment (I sent an image of the page by separate email.) About half of the controls are "dummy", disabled select controls used to emulate "readonly" functionality for the "real" select controls. After the page loads it takes from 6 to 10 seconds before the page is responsive. I determined that almost all of this time is spent somewhere in zebra_form.js (the page load speeds up by that much when I do not load that one javascript file).

Do you have any suggestions for how I might speed up the page load? For example, whatever initialization it is doing on the controls in the ".each" loop, is there a property I can put on the "dummy" controls so it will skip them? Or any other suggestions?

Thanks and Best Regards,

stefangabos commented 8 years ago

Can you please email me the code for generating that monstrosity of a form? :) I'll definitely have a look once I can reproduce the issue. It’s most likely something that’s altering the DOM – usually that is something that takes up a lot of time (although, I don’t see that you have that so, I assume it’s an issue with my code somewhere)

JeffBuckles commented 8 years ago

Here's a test case.

Rather than including the monstrosity that is the code generating the form :) (I'm really a hardware guy, not a software professional), I built a test case using the rendered html. The main page is "SetupClassSessions.php".

This is not high priority; don't spend a lot of time on it unless it's interesting to you!

Thanks and Best Regards, -- Jeff Buckles -- Aloha, OR, USA -- jeff.buckles-github@bookloaf.net

On 2/10/2016 1:00 AM, Stefan Gabos wrote:

Can you please email me the code for generating that monstrosity of a form? :) I'll definitely have a look once I can reproduce the issue. It’s most likely something that’s altering the DOM – usually that is something that takes up a lot of time (although, I don’t see that you have that so, I assume it’s an issue with my code somewhere)

— Reply to this email directly or view it on GitHub https://github.com/stefangabos/Zebra_Form/issues/23#issuecomment-182262259.

stefangabos commented 8 years ago

You forgot to attach the file. I am very interested in making the library better!:)

JeffBuckles commented 8 years ago

Commenting with regard to our email exchange in case anyone else comes looking about this issue. I had too many dependencies in the form. However, I wonder if there is any opportunity to optimize this on page load when the first dependency is a "submit" button. Do these need to be validated on page load, or only when the form is submitted? Thanks!

JeffBuckles commented 8 years ago

Workaround was to disable clientside validation. This can be closed. Thanks,

stefangabos commented 8 years ago

This is not really a solution...I'm going to look more into this, just to make sure that there are no faults in the code

JeffBuckles commented 8 years ago

I think also I'm abusing the concept of "HTML form" with this page design... :) A better solution has been found! Thanks for checking into it.