Hi, I am new to Alfresco. I am developing a process in APS(Alfresco Process Services) for which I designed a form and submit button of this form triggers this process. Now, I used 'adf-start-form' component to display this form on browser using ADF. This template is referenced using #startForm template reference variable. (<adf-start-form #startForm>). Now I want to access a DOM element (button) inside this form. I have tried following approaches:
@ViewChild('startForm',{read: ElementRef})
btn: ElementRef;
ngAfterViewInit() {
console.log(this.btn.nativeElement.querySelector(".class of button").innerText);
}
and
@ViewChild('startForm')
startForm: StartFormComponent;
ngAfterViewInit() {
console.log(this.startForm.outcomesContainer.nativeElement.innerText);
}
But, none of them is working. Could you please suggest how to access a DOM element of the form. Thanks.
Solved! Go to Solution.
you can use a custom outcome in the form editor of APS
Form component has lot of APIs, the Form Service allows listening to most of the form events including Outcome clicks. Getting buttons in the "jQuery" way is not the right approach
alfresco-ng2-components/form.component.md at master · Alfresco/alfresco-ng2-components · GitHub
alfresco-ng2-components/form.service.md at master · Alfresco/alfresco-ng2-components · GitHub
Can I ask the reason why you are trying to access to the submit button? so what is the behavior that you want add?
I just want to change text on submit button
you can use a custom outcome in the form editor of APS
It worked. Thanks.
Thanks.
Discussions, help and advice about the Alfresco Development Framework.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.