0

I have an ajax auto complete extender, with custom webservices filling a list in a text box on an .aspx page. IE works fine but when using Chrome or Firefox, this text box is having the autocomplete = off attribute appended to it which is exactly opposite of what I need. I've tried changing the z-index in the css class, adding autocomplete=on inline on the text box, removing the auto complete attribute on focus via JavaScript, removing the auto complete attribute on pageload and setting the auto complete attribute of the top level Master Page to on. The page does have some jquery on it to support a drag and drop feature, but I've been unable to find if this is causing the attribute to be added. I'm out of ideas and could use some guidance.

EDIT: Forgot to mention that when I put a text box and autocompleteextender on a test page within the same application, using the same web services it works fine. When I inspect the element, it still has the autocomplete = off attribute, but it does not seem to affect the functionality. Thanks!

aspx page code:

    <ajax:AutoCompleteExtender ID="acDisciplines" runat="server"     TargetControlID="txtDisciplinesAuto" ServiceMethod="GetDisciplinesAuto" MinimumPrefixLength="1" CompletionInterval="100" EnableCaching="true" FirstRowSelected="true" CompletionListCssClass="autoCompleteExtenderList" CompletionSetCount="20" 
    >
    </ajax:AutoCompleteExtender>

    <asp:TextBox ID="txtDisciplinesAuto" runat="server" EnableViewState="false"></asp:TextBox>



   css:

    .autoCompleteExtenderList
    {
        z-index: 10009;
        border: 1px solid black;
        width: auto !important;
        padding-right: 10px;
        padding-left: 10px;
        background-color: White;
        max-height: 400px !important;
        position: absolute;
            x-overflow:hidden;
            y-overflow:scroll;

    }



 jquery/javascript just in case:

 <script type="text/javascript">
     $(init);

     function init() {
         $('[id$=divMoveHelp]').hide();
         $('[id$=divHelp]').hide();

         $('[id$=lnkHelp]').click(helpLinkClicked);

         $('.dragClass').draggable({
             containment: 'document',
             revert: 'invalid'
         });

         $('.dropHeader').droppable({
             activeClass: 'classMoveActive',
             hoverClass: 'classMoveHover',
             drop: handleDropEvent,
             activate: handleDragActive,
             deactivate: handleDragStop
         });
     }

     function helpLinkClicked() {
         if ($('[id$=divHelp]').css('display') == 'none') {
             $('[id$=divHelp]').show();
         }
         else {
             $('[id$=divHelp]').hide();
         }

     }

     function handleDragActive(event, ui) {
         $('[id$=divMoveHelp]').show();
     }

     function handleDragStop(event, ui) {
         $('[id$=divMoveHelp]').hide();
     }

     function handleDropEvent(event, ui) {
         var draggable = ui.draggable;
         var classText = getClassText(draggable);
         var termText = $(this).text().trim();
         var yearRowID = $(this).parents('[id$=tblYearGrid]').find('[id$=lblYearRowIDInner]').html().trim();
         var edPlanID = $(this).parents('[id$=tblYearGrid]').find('[id$=lblEdPlanIDInner]').html().trim();
         var classID = $(draggable).parent().children('.classID').text().trim();
         var titleText = $(draggable).children('a').attr('title').trim();
         var originTerm = $(draggable).children('a').attr('id');

         if (originTerm.indexOf('Fall') >= 0) {
             originTerm = 'Fall';
         }
         else if (originTerm.indexOf('Winter') >= 0) {
             originTerm = 'Winter';
         }
         else if (originTerm.indexOf('Spring') >= 0) {
             originTerm = 'Spring';
         }
         else if (originTerm.indexOf('Summer') >= 0) {
             originTerm = 'Summer';
         }

         $(draggable).hide();


         $('[id$=txtClass]').val(classText);
         $('[id$=txtTerm]').val(termText);
         $('[id$=txtYearRowID]').val(yearRowID);
         $('[id$=txtClassID]').val(classID);
         $('[id$=txtClassTitle]').val(titleText);
         $('[id$=txtOriginTerm]').val(originTerm);
         $('[id$=txtEdPlanID]').val(edPlanID);
         $('[id$=btnMoveClass]').click();
     }

     function getClassText(obj) {
         var val = $(obj).text().trim();
         return val;
     }

     //override the autocomplete for chrome and firefox
     var autocompleteTB;

     // After the document has loaded, manipulate DOM elements.
     window.addEventListener('load', function () {

         // Get the username field element.
         autocompleteTB = $get('<%= txtDisciplinesAuto.ClientID %>');

         // Listen to the 'focus' event on the input element.
         autocompleteTB.addEventListener('focus', function () {

             // Remove the autocomplete attribute when the textbox comes in focus
             autocompleteTB.setAttribute('autocomplete', 'on');

         }, false);

     }, false);
    </script>
user3014776
  • 13
  • 1
  • 4
  • Your browser doesn't change the source HTML. Your browser just renders it. Although it's possible something in your server or client side code changes the source HTML based on the browser. – mason Jun 26 '14 at 23:44
  • Thanks mason, I wasn't clear in saying that I don't know what is causing this attribute to be added to the text box. I would like to find out so I can work around it. – user3014776 Jun 26 '14 at 23:54
  • You should start by determine the minimal amount of code necessary to reproduce your problem, rather than having it all here at once. – mason Jun 27 '14 at 00:29

0 Answers0