+ Add post
I want to make a generic method, which will give me for each input
"bdcfc348-9df5-f345-cb20-14103f818794" .... />
for every $context._crtControls element.
i want to add Focus event handler.
in the given example it has "PlaceOfBirth" key.
Like
This can be achieved in DOM with the code like:
const textEl = document.getElementsByClassName("crt-input-control")[0].childNodes[0] textEl.addEventListener('focus', (event) => { event.stopPropagation(); console.log('focused'); })
But you need to study the page content to properly process the NodeList and add the focus event to the needed input.
.
Oleg Drobina,
That is the problem, that I can't find out to which attribute the input belongs
Davit Gharagebakyan,
how about using textEl.ariaLabel to get the label (caption) for the input and use it to identify the needed element?
in my case area label is BIrthplace (for example). I don't have such a text in context. (only in very deep nested objects =>
$context.viewModelGenerator.injector._lView[3][3][3][3][3][3][3][3][3][3][3][3][3][3][3][3][3][3][3][3][3][3][3][3][3][3][8]._faviconService._sysSettingsService.httpClient.handler.injector.parent.parent.records[11][1].value._modules[0].instance._crtInjectionContextService._injectionContextsMap[0][1]._injector.records[3][1].value._crtRouter._location.window.handlerChain._handlersCache[18][1][0][1]._next._injector.records[3][1].value._routerOutletHistory._items[8].view.pageRef.instance.schemaState.models[0]._dataSourceFactory._dataSourceRepository._repository[2][1]._queryExecutor._httpClient.handler.injector.records[1291][1].value.cachedInjectors[0][1].records[297][1].value._dragDropRegistry._dropInstances[0].data._changeDetectorRef._lView[3][3][3][3][3][3][3][3][3][3][3][3][3][3][3][3][3][3][3][3][3][3][3][3][3][3][3][3][3][3][3][3][3][3][3][8]._cacheService._componentRefCache[0][0].instance.refs.root.changeDetectorRef._cdRefInjectingView[19].queries[0].queryList._results[0].changeDetectorRef._lView[4][4][4][8][0]._lView[13][9][0][3][3][3][3][3][3][3][3][4][8][0]._lView[4][7][0]._results[0]._closestTab._closestTabGroup._tabs._results[0]._viewContainerRef._lContainer[4][9][0][13][8][0]._lView[13][8][0]._lView[19].queries[1].queryList._results[0]._rendered[0][0]._declarationLView[19].queries[3].queryList._results[0].changeDetectorRef._lView[4][4][4][4][4][4][4][8][0]._lView[13][4][4][8][0]._lView[30])
I am going to change the value of an input when i clicked a buttun. How can i do that?
Hello,
Could you please elaborate on the task you want to achieve?
Which button are you referring to?
Thank you,
Artem.
Artem,
Artem thanks for your reply.
I am going to change Inputs` value on ContactPageV2 page when I click costum button. Like I when I clicked button Age's value should change to 24.
You could use the next method:
Insert the code below into the click handler function of your button:
this.set("Age", 24);