Edgewall Software
Modify

Opened 9 years ago

Closed 9 years ago

Last modified 5 years ago

#12228 closed defect (fixed)

Disable autocomplete on datepicker and datetimepicker inputs

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Milestone: 1.2
Component: general Version:
Severity: normal Keywords: jqueryui
Cc: Branch:
Release Notes:

Autocomplete is disabled for text fields with a datepicker or datetimepicker.

API Changes:
Internal Changes:

Description (last modified by Ryan J Ollos)

It would be nice to disable autocomplete on the datepicker and datetimepicker inputs.

Proposed change:

  • trac/templates/layout.html

    diff --git a/trac/templates/layout.html b/trac/templates/layout.html
    index 96d93a1..f14da91 100644
    a b  
    6262        $(".trac-autofocus").focus();
    6363        $(".trac-target-new").attr("target", "_blank");
    6464        if ($.ui) { /* is jquery-ui added? */
    65           $(".trac-datepicker:not([readonly])").datepicker();
    66           $(".trac-datetimepicker:not([readonly])").datetimepicker();
     65          $(".trac-datepicker:not([readonly])").datepicker()
     66            .focus(function() {
     67              $(this).prop("autocomplete", "off");
     68//              return false;
     69          });
     70          $(".trac-datetimepicker:not([readonly])").datetimepicker()
     71            .focus(function() {
     72              $(this).prop("autocomplete", "off");
     73//              return false;
     74          });
    6775        }
    6876        $(".trac-disable").disableSubmit(".trac-disable-determinant");
    6977        setTimeout(function() { $(".trac-scroll").scrollToTop() }, 1);

Should I return false to avoid the default behavior and prevent bubbling? So far I can't see any difference in behavior when returning false vs no return value.

Attachments (1)

Autocomplete.png (88.0 KB ) - added by Ryan J Ollos 9 years ago.

Download all attachments as: .zip

Change History (5)

by Ryan J Ollos, 9 years ago

Attachment: Autocomplete.png added

comment:1 by Ryan J Ollos, 9 years ago

Description: modified (diff)

comment:2 by Jun Omae, 9 years ago

Good idea.

I think we could simply set autocomplete="off" without focus() listener.

-          $(".trac-datepicker:not([readonly])").datepicker();
-          $(".trac-datetimepicker:not([readonly])").datetimepicker();
+          $(".trac-datepicker:not([readonly])").prop("autocomplete", "off").datepicker();
+          $(".trac-datetimepicker:not([readonly])").prop("autocomplete", "off").datetimepicker();

comment:3 by Ryan J Ollos, 9 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Thanks, that's much simpler. Committed to trunk in [14344].

comment:4 by jnanendra veer, 5 years ago

have you get any solution for this?

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Ryan J Ollos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.