FlowFuse / FlowFuse/node-red-dashboard

Form reset causes <field> is required error message

Open
#1,701 1 comment 0 reactions 0 assignees View on GitHub
needs-triage type:bug
Dominant language
HTML
Stars
355
Forks
82
Avg merge
4d 23h
Merged PRs (30d)
24

Description

### Current Behavior

I have a form with a required text field. I am using the "Reset the form when submitted" option and the standard "submit" and "clear" buttons.

![Image](https://github.com/user-attachments/assets/416d7043-8b9c-4749-99c7-16286c5a6c59)

The flow is very simple:

![Image](https://github.com/user-attachments/assets/f6455b64-6d31-4706-ab5d-d031bbf8a7d3)

As a user, I enter text into the field and hit the "submit" button. The `debug 1` node shows that the form node outputs the expected msg.payload with the user-entered data. The `debug 2` node does not fire, as expected.

The problem: on the screen, it shows the field in red and displays "Commenter Name (or Description) is required"

![Image](https://github.com/user-attachments/assets/c5d3ea6f-407d-428b-943e-345cd011efa2)

If I then press the "clear" button, the error message goes away.

I am guessing that the "submit" button action leaves the form in an internal state that is different from its initial state, and different from the "clear" state, one that causes the error message to appear.

### Expected Behavior

Submitting a form that has the "reset" option should not display the "" is required message.

Note: I experienced this error with a text input field. I would not be surprised if the same problem happens with the other input field types.

### Steps To Reproduce

Create a flow as shown above, using a dashboard-2 form node. Make sure to turn on the "required" checkbox for a text field, and the "reset" option for the form. Deploy the form, type into the required text field, hit the "submit" button, and view the error.

### Environment

- dashboard version: @flowfuse/node-red-dashboard 1.23.0
- Node-RED version: 4.0.9
- Node.js version: 20.19.1
- npm version: 10.8.2
- Platform/OS: RPiOs - Debian GNU/Linux 12 (bookworm) - Linux 6.12.20+rpt-rpi-2712
- Browser: Mac Chrome Version 136.0.7103.93 (Official Build) (arm64)

### 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.