Mar 25, 2014 12:13 PM
2 Posts

typeahead function prevent editbox styling

  • Category: Styles and Themes
  • Platform: All
  • Release: 8.5.3
  • Role: Administrator,Developer,End User
  • Tags: xpages typeahead
  • Replies: 1
I have two edit boxes.
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
Mar 26, 2014 9:26 AM
366 Posts
XPages rendering engine assignes id's

you have to use the csjs / ssjs conversion to get the id of the element you want in your csjs.

either

"#{javascript:getClientId("CustomerName1")}"

or

"#{id:CustomerName1}"

so in your case dojo.byId("#{id:myEditBox}");

should work if the name of the component is 'myEditBox'