Closed Bug 1808843 Opened 3 years ago Closed 3 years ago

Autocomplete is too aggressive and overwrites values of hidden fields.

Categories

(Toolkit :: Form Manager, defect, P3)

Firefox 108
x86
Windows Server 2003
defect

Tracking

()

RESOLVED DUPLICATE of bug 1247245

People

(Reporter: hemant.gupta, Unassigned)

Details

+++ This bug was initially created as a clone of Bug #520561 +++
Summary of original bug
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)

If I have an .ASPX page set a value of a hidden field, the autofill of FF 3.5.3 overwrites that value with it's own auto fill value.

Reproducible: Always

Steps to Reproduce:

  1. Create an aspx page with a hidden field
  2. Set the value of the hidden field in the code behind (onLoad, or OnPreRender doesn't matter).
  3. Check the value of the hidden field through a javascript event, and see it is reset to a previous value.
    Actual Results:
    The .aspx page contains...
    ...
    <a runat="server" id="toggleText" href="" style="cursor:pointer;">Toggle</a>
    <input id="hd_Text" runat="server" type="hidden" />
    ...

The code behind sets the initial value...
protected override void OnLoad(EventArgs e)
{
...
HtmlAnchor btn = (HtmlAnchor)FindControl("toggleText");
HtmlInputHidden hf = (HtmlInputHidden)FindControl("hd_Text");
if (btn != null && hf != null)
{
string clickText = String.Format("ToggleText('{0}');", hf.UniqueID.Replace("$", "_"));
btn.Attributes.Add("onclick", clickText);
hf.Value = "1";
}
....
}
The javascript implements...
function ToggleText(hf_id) {
var hf = document.getElementById(hf_id);
if (hf != null) {
var statusValue = parseInt(hf.value);
alert(hf.value);
var newvalue = parseInt(statusValue) + parseInt("1");
hf.value = newvalue;
}
}

Expected Results:
Note that the javascript displays the value of the hidden field. In FF 3.5.3 when I toggle the hidden field several times, and then refresh the page, the value is not reset to the original value. Instead FF 3.5 set's it to the toggled value. Q: why is FF setting hidden fields anyway???

I can run the same simple page in IE 6-8, Chrome 3.0, Safari 4.0 (none of which form fill as well, but they also leave the hidden field alone). This did not happen in FF 3.0.

Additional details:

Please help in resolution of this issue.
Thanks

Severity: -- → S3
Status: UNCONFIRMED → RESOLVED
Closed: 3 years ago
Duplicate of bug: 1247245
Priority: -- → P3
Resolution: --- → DUPLICATE

hi Sergey

I had to create this issue since it is still active. Please refer the below information posted at the end of summary:

Additional details:

I am using Drupal CMS which is also affected by this bug, To workaround this bug drupal CMS is adding autocomplete=off attribute in the hidden input element https://www.drupal.org/project/drupal/issues/2596597 which results in invalid HTML being reported by HTML validator tools (https://www.drupal.org/project/drupal/issues/3320467).
Please help in resolution of this issue.
Thanks

Thanks hemant.gupta, we do recognize this problem and it's just being tracked in another bug. Your feedback will be taken into consideration for sure!

Thanks Sergey

You need to log in before you can comment on or make changes to this bug.