Search code examples
xpagestype-ahead

typeahead function prevent editbox styling


I have two edit boxes on my xPage. Second one with typeahead enabled. I want on onFocus event make editbox background e.g. yellow... I do it this way:

var fldObj = dojo.byId("myEditBox");
if (!fldObj) {
    fldObj = dojo.query("[id$=':myEditBox']");
    if (fldObj) {
        fldObj = fldObj[0];
    }
}
if (fldObj != null) {
    fldObj.style.background="yellow";
}

it works perfect for the first edit box but not for the one with typeahead enabled.. Any suggestion?

Thanks


Solution

  • Simple CSS does the trick. Your problem is probably caused by dojo CSS styling. Added !important overrides other inherited !important styling. Works for me with edit box with and without typeahead.

    .xspInputFieldEditBox:focus, .lotusui .dijitTextBox input:focus, .xspComboBox:focus
    {
      font-weight: bold;
      background-color: yellow !important;
      background: yellow !important;
    
    } 
    

    http://www.w3schools.com/cssref/sel_focus.asp