This version is old school.
Please find jQuery plugins on npm.
jQuery Maxsubmit
by Jason Judge
jQuery plugin to catch forms with too many POST variables for the server, allowing the user to avoid lost data.