A bug caused by disabled Web Control

Source: Internet
Author: User

The customer reported that they could not log on after modifying their information.
So I tracked the page on which the customer modified the data and found that some controls were disabled to restrict the user from modifying some system options.
Check againCodeNo obvious problems were found, so code execution was tracked.

Finally, it is found that a select control returns an incorrect value: select1.selectedvalue is always the value of the first item.
Then, we track the value assignment and find that the value of select1 has been selected with the correct options, and the results displayed on the page are also normal.
Painful. I cannot figure it out for a long time.

The last thing I remember is that when the disabled control is removed, the browser will not submit its value to the server when it is submitted: After the select1 control is disavisible, and when it is PostBack, the control cannot obtain this value, so the first item is used as the default value. This bug is caused by disabled.

For ease of use, directly write a script to solve this problem:
<Form onsubmit = "Return check (this)">

Function check (FRM)
VaR ncount = FRM. length;
For (VAR I = 0; I <ncount; I ++)
FRM [I]. Disabled = false;
Return true;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.