-
Notifications
You must be signed in to change notification settings - Fork 556
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable the form on NgOnInit doesn't disable formly #2598
Comments
|
There was another issue that @aitboudad recomended the this.form.disable(); to disable the form. |
Does this fix address the issue with the styling also ... here's the issue I had noticed earlier; |
@SubrahmanyaV there is no issue in styling, just make sure the defined |
.disabled, Not sure if this info helps but I have two forms on the same page, one is an Angular Material 10 form & the second is the Formly/Material form. The color style is reflected in Angular form but not in Formly form. Below is the snippet of code I am using to disable the Formly fields; Background: I fetch my Formly field definition from the database & subsequently disable all the fields with above code. |
@SubrahmanyaV could you please provide a simple reproduction example using our stackblitz https://stackblitz.com/edit/ngx-formly-ui-material |
This issue has been fixed and released as part of v5.10.7 release. Please let us know, in case you are still encountering a similar issue/problem. |
|
I got the inverse problem now @aitboudad
Seems to me that there is some cache from the previous component in the memory, it's strange, I have another issue when I change the item i'm editing, but I'll try to reproduce better |
A reproduction is needed 🙏! |
is it ok if I zip an example and attach it here? |
ok |
To execute this you need this steps
On the side I have another issue, if you open one item, and you open another item, you will get an error from the kendo editor, I opened an issue in kendo but I coudn't solve it, they claim it's something about formly |
This means that you sucessfully ran the code I sent? did you catch the two errors ? the disables one and the html editor one? I put them together because seems to be the same origin. |
I'm not able to make it work due to the missing of For the editor error, probably the editor component doesn't support reactive-form, the solution is to rely on editor outputs to trigger formControl value changes:
Note: |
the AGL-kendo is on the zip file, installed on the node_modules the editor I opened an issue on kendo and it's ok for reactive forms |
still getting some errors, a simple reproduction using https://stackblitz.com/edit/ngx-formly-ui-bootstrap is needed 🙏 |
I put the code on https://stackblitz.com/edit/angular-ivy-q3icdx?file=package.json |
sorry but that took me much more time than I expected, feel free to reopen when you can provide a small reproduction example using stackblitz.com |
@aitboudad I made it work, it's taking me much more time than I expected also https://angular-ivy-q3icdx.stackblitz.io/#/complexidade the css style is not working but you can see the problem there are 3 different problems
But the errors rely on the fact that something from the last execution is on the component, I'm not sure what https://stackblitz.com/edit/angular-ivy-q3icdx?file=package.json I tested changing the html editor back to input to see the errors the errors 1 and 2 dissapear, but the 3 remains the same Thanks for the help |
The shared |
I tried to upload to stackblitz, it didn't work the code is in this repo https://github.com/luizfbicalho/angular-ivy-q3icdx/tree/master There are a lot of kendo components on this project, grid, tree grid, html editor |
|
Sorry but i couldn't reproduce It the other way |
I've reverted the initial commit which attempts to take account of form disabled state during the build step, so instead of that the solution is to disable the form using hooks #2379 (comment) |
I changed to this and got this error TypeError: Cannot set property model of [object Object] which has only a getter I'll update the stackblitz today |
I found the reason @aitboudad there is something about reading the JSON and loading the fields from it EDIT Now I think that I got it, when I used the first json, formly injected some information on the json object with the fields, and on the next time there was some problems with the first injection. is this a bug? is this the design? what do you think? |
use @NgModule({
imports: [
FormlyModule.forRoot({
extras: { immutable: true }
}),
],
}) Also to track the model value changes, use <formly-form [model]="model" (modelChange)="modelChange($event)"` ...> |
Thanks, this looks nice, I have three questions @aitboudad
|
We try to not touch
Check the source code https://github.com/ngx-formly/ngx-formly/blob/main/src/core/src/lib/models/config.ts#L55-L82 |
Do you have an update on the styling issue, please let me know the version if it has been addressed, thanks. |
@SubrahmanyaV could you please put a little effort to provide a reproduction (https://stackblitz.com/edit/ngx-formly-ui-material), it essential for me in order to gain some time, and thanks in advance for your understanding! |
Description
Minimal Reproduction
If on init I disable the form, it doesn't work the disable.
https://stackblitz.com/edit/angular-fpuvb7
Your Environment
Additional context
The text was updated successfully, but these errors were encountered: