-
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
Multi step form with same model object #1358
Comments
unfortunately that's an angular issue angular/angular#13792, not sure how it can be solved. |
Thank you for your info. I tried workaround, it populated two properties in model but in second step the field is empty again. May be have to wait to be fixed in angular. |
the angular fix may take a long time, you may remove the extra property before submitting your form instead. |
@aitboudad if i have a look on your workarround, i don't see that this is working. If i go to the second step of your wizard, the name field is empty |
@flobiber updated the example, using |
@aitboudad Okay i think i miss understand the original problem. My problem is more like this: |
you may use the following workaround https://stackblitz.com/edit/angular-p5rqay-hkrc18 for now until angular team fix that issue |
@flobiber updated my workaround, based on angular/angular#13792 (comment) https://stackblitz.com/edit/angular-p5rqay-hkrc18 |
Can i use customise model in multi step formly field. |
My forms work in distinct Edit and Search modes. it defaults to search mode. The idea is I'd hide/show the different controls based on edit mode. I tried this.. https://stackblitz.com/edit/ngx-formly-duplicate-keys?file=src%2Fapp%2Fapp.component.ts And it appears to work. However there is something that does not make sense... toggle() { Why did I have to invert the hideExpressions for the different fields? Why does this not work? What am I doing wrong? |
@instantgis it's just an example, you can also make it globally by using formState with the combination of custom extension |
@GetTaxSolutions @aitboudad fields: FormlyFieldConfig[] = [{
type: 'tabs',
fieldGroup: [
{
**key: "Personal data",** ### _Insert key here (tab label)_
templateOptions: { label: 'Personal data' },
fieldGroup: [
{
key: 'firstname',
type: 'input',
templateOptions: {
label: 'First name',
required: true,
},
},
{
key: 'age',
type: 'input',
templateOptions: {
type: 'number',
label: 'Age',
required: true,
},
},
],
},
{
**key: 'Destination',** ### _Insert key here (tab label)_
templateOptions: { label: 'Destination' },
fieldGroup: [
{
**key: 'firstname',** ### _Duplicate field_
type: 'input',
templateOptions: {
label: 'First name',
required: true,
},
},
{
key: 'country',
type: 'input',
templateOptions: {
label: 'Country',
required: true,
},
},
],
},
{
templateOptions: { label: 'Day of the trip' },
fieldGroup: [
{
key: 'day',
type: 'input',
templateOptions: {
type: 'date',
label: 'Day of the trip',
required: true,
},
},
],
},
],
}]; |
I'm using your example and have two fields which point to same key in model but they are in two different steps in wizard. When I fill first one It have to update input field in second step as well but it's not. When try to write something in second step it update exact same property in model.
Example /field 'First name *' in first and second steps in the wizard/ :
https://stackblitz.com/edit/angular-p5rqay?file=src/app/app.component.html
The text was updated successfully, but these errors were encountered: