FlowFuse / FlowFuse/node-red-dashboard

Prefill a required form field of type Number with value 0 results in error

Open
#1,702 0 comments 0 reactions 0 assignees View on GitHub
size:XS type:bug
Dominant language
HTML
Stars
355
Forks
82
Avg merge
4d 23h
Merged PRs (30d)
24

Description

### Current Behavior

When setting the default value for a Required Field in a Form node to 0 (zero), the dashboard shows an error message below this field " is required" and the color of the field is set to red. However, the value 0 is shown in the field, so it is not empty

### Expected Behavior

Field should not be set to error state. Probably checked with not operator (!) instead of using 'null' test

### Steps To Reproduce

1. Add Form node
2. Add field
3. Set field to type Number
4. Check Required property for field
5. Send input message to Form node with payload. set to 0 (zero), as documented [here](https://dashboard.flowfuse.com/nodes/widgets/ui-form.html#populating-form-data)

### Environment

- Dashboard version: 1.23.0
- Node-RED version: 4.0.1
- Node.js version: v20.9.0
- npm version: 9.6.7
- Platform/OS: Windows 11
- Browser: Chrome 136.0.7103.93 (Official Build) (64-bit)

### Have you provided an initial effort estimate for this issue?

I am not a FlowFuse team member

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.