Fix bugs connected with jQuery.form (tickets: #6181, #8710)