How to update form data after click event custom “Button” control?
See original GitHub issueI created new custom control like button and after every click I need to update value of this control
import ButtonComponent from 'formiojs/components/button/Button.js';
export default class DynamicButton extends ButtonComponent {
...
build() {
this.dataValue = '';
...
this.addEventListener(this.buttonElement, 'click', (event) => {
this.dataValue = "some data";
});
}
...
}
So, value is updated and if I print console.log(this.data)
here it’s also updated, but it doesn’t trigger “change” event on form and when I submit form then data for this control doesn’t exist.
What I need to execute to trigger “change” event on form and populate data of this control to form?
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
How to add event to custom control that fired when click a ...
this in the click method on each button do something like this: public void Button1_Click(object sender, EventArgs e) { if (OnButton1Click ...
Read more >Adding a custom button on a form widget - ServiceNow
I'm trying to add a custom button (called submit) on a form widget . When I click the button , it doesn't look...
Read more >Assign a macro to a Form or a Control button - Microsoft Support
Add a button (Form control). On the Developer tab, in the Controls group, click Insert, and then under Form Controls, click Button Button...
Read more >How to build custom form controls - Learn web development
For example, all four arrows navigate through the options, but clicking the down arrow when the user is on the last button takes...
Read more >SharePoint 2013 - Custom save button - Handling click using ...
For example, on the "click" event of our custom button, we need to assign values based of values entered by the user. So...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I did the following:
But
this.data = { "userName": "some data" }
andthis.dataValue = undefined
. Why does this happen? Maybe because I inherit my control from “Button” that has justtrue
orfalse
value and this control overwrites value somehow?I also have:
How can I populate
this.dataValue
?I resolved that issue. I just inherit my custom control from TextFieldComponent.