sapui5sap-fiori

How to Customize the Icon or Value Help Indicator in sap.m.Input?


I am working with sap.m.Input in a UI5 application and need to replace the standard value help icon.

<Input
  valueHelpIcon="sap-icon://search"
  showValueHelp="true"
  valueHelpRequest=".onValueHelpRequest"
/>

How can I change the default value help icon? The valueHelpIcon property doesn't seem to work in sap.m.Input.

Can I completely replace the default value help indicator with a custom icon or button? If so, what's the best approach?

What I've tried:

I'd appreciate any guidance or alternative approaches to achieve this customization.


Solution

  • The Input control doesn't allow you to specify which icon should be used as value-help icon. You can see in line 415 of Input.js that the value help icon is hard-coded.

    However, if you need a version of the input control that does allow you to specify which icon is used, I would suggest to create a custom Input control. This Input control could be as simple as subclass of the standard UI5 Input control. And then just override its _getValueHelpIcon method.