What is the correct way to submit a form in toddle?
My initial understanding was that the correct way to submit a form in toddle is to set a submit event on the form element and then add a type =submit attribute to the button element inside the form that would trigger the form submission . Then I put my API call or any logic into the form 's submit event actions . But while troubleshooting a form that wasn 't submitting , I asked the toddle AI and I got this (see screenshot ) . Does this mean that the correct way to set up the form in toddle is to 1 ) Not set any event on the form element 2 ) Set a type =button attribute on the submit button . 3 ) Set the submission logic or API call to this submit button 's click event ? If I remember correctly , there was a user that wanted to trigger different things from inside a form without submitting it . In such a case , the button shouldn ’t be type submit Your current method is the proper way to submit a form Sorry one last thing . My form doesn 't have a "button " element per se , it has an instance of a button component that I 've created (ui -button ) . Now in my ui -button component (master ) , I started with the button tags and set up my button with icons left and right and all of that . I also added a type attribute that takes a value from the outside (button instance ) and sets the type attribute of the actual button component to submit . For some reason this does NOT trigger the form when I click it . If however , instead of using a button component , I use a regular button element inside my form and set its type to submit , then that triggers the form submission . Looks like there 's something off with my button component and that it 's not taking the submit attribute from the instance or something . Am I approaching this the right way ? What else could I be overlooking ? Basically you ’re seeing the type attribute in the button via a component attribute Is that right ? The submitting element is not a button element itself , it is an instance of a custom button component and I added a type attribute to this component . Now in the instance , that is , the actual element in the form , I set this type attribute to submit . Then on the component , not the instance , I catch this attribute (fed in by the instance ) , and set the top layer to have a type attribute = attribute passed into the component , which is "submit " . Could it be that the reason this isn 't working for me is because I 'm using a custom component (ui -button ) to trigger the form 's submit event ? Because instead of a component , if I use a native button element in the form (no component ) , then the form submits fine . I use button components as well That will break the click It works without it - 😂1❤️1