Is there any method to update FormBuilder's components without re new a FormBuilder?
See original GitHub issueconst builder = Formio.builder(document.querySelector('#form'), {}, options);
Now I want to update the initial components, is there a method like
const myComponents = [
{
label: 'Text Field',
allowMultipleMasks: false,
showWordCount: false,
showCharCount: false,
tableView: true,
type: 'textfield',
input: true,
key: 'textField',
widget: {
type: ''
}
}
];
builder.updateComponents(myComponents);
I have tried builder.clear()
and builder.build({components: myComponents})
, but it not work.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Manually Set Value for FormBuilder Control
There are two ways to update the model value: Use the setValue() method to set a new value for an individual control. The...
Read more >Updating Angular Forms with patchValue or setValue
If you're still guessing which method to use to update a Reactive Form value in Angular, then this post is for you. It's...
Read more >FormBuilder
Returns a FormBuilder in which automatically constructed @see FormControl} elements have {nonNullable: true} and are non-nullable.
Read more >Using FormBuilder In Angular
Import the FormBuilder class from the @angular/forms package. File name : employeeDetails-editor.component.ts. 1import ...
Read more >The updateOn Option in Angular Forms
When using Angular Forms, by default, on every keystroke, the values of your form controls are updated and their associated validators are executed....
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
In case someone desperately searches for code samples of how to update the form builder at runtime (after saving data somewhere and return ids and store them in
components.*.properties.id
or whatever) I put a demo together on how to usebuilder.setForm()
to set a schema programmatically.https://codepen.io/localhorst/pen/BaaEBZz
At this point, I have no clue why I have to use
new Formio.FormBuilder()
instead ofFormio.builder()
and a mix ofbuilder.instance.*
andbuilder.setForm()
. I hope devs can shed some light on this or extend the docs. I hope this helps someone.Hey @kokororin , if
builder.setForm()
is working for you, then I can confirm that this is the correct way to do it and it should be good. Let us know if it is still a problem and we will elevate the ticket in our internal system.