Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Analysis on the problems of Picture Button submission and form repeated submission in web Development

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces the problem analysis of picture button submission and form repeated submission in web development, which is very detailed and has certain reference value. Interested friends must finish reading it!

In many cases, in order to beautify the form, the submit button will be changed to a picture instead. But if you don't pay attention to the details, it can lead to repeated submission of the form, leading to some inexplicable errors, such as repeatedly inserting database records.

Let's look at the following simple form code:

The code is as follows:

This code is correct and there will be no problem of repeated submission. "" In fact, the effect is the same as "". A little bit of that picture will perform the submit () operation.

But some people are worried and add an onclick action to image, such as:

The code is as follows:

Now click the picture button and submit it twice, resulting in repeated submissions. Its function is equivalent to:

The code is as follows:

How does a button like this prohibit repeated submissions?

Solution:

The code is as follows:

There are two ways to submit a form using a picture:

1.

This picture will automatically submit the Form form, that is, type= "submit" if you want to judge and verify it before submitting it.

The code is as follows:

It is normal to submit in this way, and the effect is the same as above. Therefore, please avoid submitting data in the first way, especially in the application of struts

Note: css: cursor:hand can only be recognized by IE, not Firefox. And pointer is compatible!

Note! Either way, the submission is included in between, otherwise, the submission is invalid

These are all the contents of this article entitled "problem Analysis of Picture Button submission and form repeat submission in web Development". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report