Content Management and Capture

Content Management and Capture

Come for answers. Stay for best practices. All we’re missing is you.

 View Only
  • 1.  Search Template Fields Label Change using plug-in

    Posted Sun July 25, 2021 07:09 PM

    Hi,

    Requirement: I have a search template with 5 with fields. I would like to change the labels based on search template name.

    What I have done So far: I have tried below code. There are no issues reported in the debug log. But the label is not changing.

    aspect.after(ecm.widget.search.SearchForm.prototype, "onSearchCriteriaLoad", function() {

    if(this._searchTemplate.name==='S1'){

    for (var i = 0; i < this._propertyEditors._fields.length; i++) {

    var field = this._propertyEditors._fields[i];

    if(this._propertyEditors._isFieldValid(field)){

    if(field.name==='XYZ'){

    this._propertyEditors._fields[i].label = 'Custom label';

    }

    }

    }

    }

    });

    Please let me know what is wrong here.



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 2.  RE: Search Template Fields Label Change using plug-in

    Posted Mon July 26, 2021 06:36 AM

    Hi,

    After creating the HTML elements for the properties, the labels can not be set directly. You may try the following:

    aspect.before(ecm.widget.search.SearchForm.prototype, "_createSearchField", function (criterion, tablename, isChildCriterion, operatorHidden) {

    if (this._searchTemplate.name === 'S1') {

    for (var i = 0; i < this._propertyEditors._fields.length; i++) {

    var field = this._propertyEditors._fields[i];

    if (this._propertyEditors._isFieldValid(field)) {

    if (criterion.name === 'XYZ') {

    criterion.name = 'Custom label';

    }

    }

    }

    }

    });

    Please note that referencing to private functions is not suggested. You may contact your support to create an enhancement request for this.



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 3.  RE: Search Template Fields Label Change using plug-in

    Posted Mon July 26, 2021 02:52 PM

    Hi,

    Thanks as usual. Now I removed the fields loop completely. Below is the code which is working.

    aspect.before(ecm.widget.search.SearchForm.prototype, "_createSearchField", function (criterion, tablename, isChildCriterion, operatorHidden) {

    if (this._searchTemplate.name === 'S1') {

    if (criterion.name === 'XYZ') {

    criterion.name = 'Custom label';

    }

    }

    });



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 4.  RE: Search Template Fields Label Change using plug-in

    Posted Fri October 01, 2021 03:46 PM

    Hi,


    A small enhancement to the existing requirement. I need to add red asterisk for the same fields along with labels. Actually these are mandatory fields in my application.


    Regards,

    Ravi



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 5.  RE: Search Template Fields Label Change using plug-in

    Posted Fri October 08, 2021 02:22 AM

    The mandatory fields should have the "required" attribute of true value to show the red asterisks.



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration