Hi, After I create jigx form with number-field
and submit the number-field with 0
It sent null to my API
This should be bug right?
1 Like
Hi Nook, welcome to the community. I tested your findings and found the same result, and this is a bug.
Here is a workaround that you can make use of in the meantime:
Below a sample form:
children:
- type: component.form
instanceId: record
options:
children:
- type: component.text-field
instanceId: first_name
options:
label: First Name
- type: component.text-field
instanceId: last_name
options:
label: Last Name
- type: component.email-field
instanceId: email
options:
label: Email
- type: component.number-field
instanceId: incident_count
options:
label: Incident Count
initialValue: 0
Your action is most likely configured in the following way
actions:
- children:
- type: action.execute-entity
options:
title: Create Record
provider: DATA_PROVIDER_LOCAL
entity: default/summary
method: create
goBack: previous
data:
first_name: =@ctx.components.first_name.state.value
last_name: =@ctx.components.last_name.state.value
email: =@ctx.components.email.state.value
incident_count: =@ctx.components.incident_count.state.value
Instead of binding each field with the component you can also achieve the same thing using the following:
actions:
- children:
- type: action.execute-entity
options:
title: Create Record
provider: DATA_PROVIDER_LOCAL
entity: default/summary
method: create
goBack: previous
data: =@ctx.components.record.state.data
Note: If you pass the form data using data: =@ctx.components.record.state.data
the instanceId
of each component automatically becomes the field name.
I hope this workaround will allow you to continue with your project.
Let me know if you have any questions.
Renier
1 Like