formio.js icon indicating copy to clipboard operation
formio.js copied to clipboard

[Bug] Children Form Button in a nested Form is hidden.

Open Justinlcx opened this issue 8 months ago • 5 comments

Describe the bug While rendering a nested form that contain a button, the button is hidden in the webForm, even if the property hidden is unchecked.

Version/Branch Last version

To Reproduce Steps to reproduce the behavior:

  1. Create a form with a button named 'Form1'
  2. Create 'Form2' with a nested form and select 'Form1'
  3. Go in Preview.

Expected behavior The button should be visible.

Screenshots

Image

Image

Additional context The issue appears to be related to the default action value. If I change the default value in the schema to 'Event' or 'Custom', the same behavior occurs. The button remains hidden with the default value, but becomes visible when another option is selected.

Justinlcx avatar Mar 31 '25 15:03 Justinlcx

Hi, @Justinlcx ! Thank you for reporting this issue. Can you clarify which Version/Branch you reproduced this on?

UPD. In a situation where the button's action is set to Submit, the button is not supposed to be visible — this is the expected result. If the button's action is changed, it will be displayed. I’ve attached a video below with an example.

Let us know if you still have questions.

https://github.com/user-attachments/assets/477aae3f-84b6-4980-9855-567501a801aa

Victoriya25 avatar Apr 09 '25 15:04 Victoriya25

Hi, @Victoriya25 I am currently running version 4.19.1

In my case, before loading the form, I update the Form Schema to remove the submit action options from the button and change the default action from "submit" to "event".

Below, you can see how I initialized the button schema.

const defaultSchema = Components.components.button.schema;

    Components.components.button.schema = (...extend) => {
        const schema = defaultSchema(...extend);
        schema.action = "event";
        schema.key = "event";
        return schema;
    };

However, the issue is that the button with a default action remains hidden in a subform, even when it's not set to "submit". If I change the value in the component, another action ("custom") makes the button visible. However, when the action is reverted to the initial schema action ("event" in my case), the button becomes hidden in the subform.

Justinlcx avatar Apr 10 '25 19:04 Justinlcx

Is this still reproducible in the later versions? @formio/[email protected] is the latest release

lane-formio avatar Apr 21 '25 14:04 lane-formio

I will test that as soon as possible.

Justinlcx avatar May 08 '25 19:05 Justinlcx

@lane-formio @Victoriya25 We upgraded our program to @formio/[email protected] (which is specifically required by @formio/react, so we can't update to @5.1.1), but the issue remains unresolved.

Justinlcx avatar Jun 04 '25 14:06 Justinlcx

After some internal conversation I found we do this intentionally so that you don't get dueling submit buttons when you embed a Nested Form component. The "Save as Reference" checkbox means that the nested form will get submitted separately and a reference ID to that submission will be stored in the parent submission.

lane-formio avatar Jul 08 '25 20:07 lane-formio