[Bug] Children Form Button in a nested Form is hidden.
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:
- Create a form with a button named 'Form1'
- Create 'Form2' with a nested form and select 'Form1'
- Go in Preview.
Expected behavior The button should be visible.
Screenshots
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.
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
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.
Is this still reproducible in the later versions? @formio/[email protected] is the latest release
I will test that as soon as possible.
@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.
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.