开发者

Is it good to use more than one forms on a page?

开发者 https://www.devze.com 2023-01-25 23:22 出处:网络
I want to use multiple forms 开发者_如何学运维in one page in my project because RightJS have many good methods for AJAX form handling. But I am afraid that it will lead to problems with speed.

I want to use multiple forms 开发者_如何学运维in one page in my project because RightJS have many good methods for AJAX form handling. But I am afraid that it will lead to problems with speed.

Does it really so?


Having multiple <form> elements can be better for performance, since you're not submitting useless information outside the scope you care about with each submit.

Use as many as appropriate - the units that your information is submitted in, that should be the scope of a particular <form> element, so you're dealing with and submitting only the information you care about with each action.

It's both semantically and performance wise a good move. At the same time, don't go completely overboard and have 100 forms, unless there are actually 100 units of work.


Speed will not be affected by having multiple forms on a page.


As long as multiple forms don't result in bad usability it's fine - why do you think they'll lead to speed problems (they don't unless you maybe have 1000 forms on your page which you hopefully don't plan to do anyway)?


Basically, as good people of stackoverflow already told you, in most cases it will be just fine, but I tell you what. The best way to answer a question like "will it be slow or not" is to implement the thing.

Just write a simple loop, generate a bunch of things on the page and see what happens. In many cases there are too many variables and hidden issues to say for sure what will happen. A little bit of an old fashioned experiment will give you more than hours of wondering around :)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号