YouTubevideo· Jul 2, 2024· 2:37· 2,500 views on YouTube

I bet you didn't know this about HTML forms

Watch on YouTube ↗
0:00

React at a moment you like. The best moments light up here.

transcript

7 moments
  1. so while recording a video I learned some new things about HTML forms that were later confirmed by some comments from that video I thought that when you had to form an HTML again this is just strict HTML standards I thought when you had to form an HTML you had to have a type equal submit on a button in that form but that's not actually true I can emit the type equal submit and any

  2. button in that form becomes a submit button so regardless of many buttons you have that are in this form tag here it's my primary button I don't have to have type equals submit for that button to work so if I say hey uh fantastic day learned about forms and I click save it just works now

  3. there's something else that I didn't know as well if you have this button let's say we don't want that submit button in our form we still want the enter down press on our keyboard to actually submit the form that's why we're using a form with a wire submit function a method now I want to take this button and place it somewhere else so instead I want to push this in the

  4. dashboard View and we can just place this like right here now here's the here's the interesting part now in our HTML form we just have to add an ID that is something that references that particular form this can be anything but if I was to go into the button and now

  5. add this form attribute with the same ID or the same identifier as this form ID right here now this button automatically becomes the submit button for that particular form this is just HTML this isn't laravel or Livewire specific if I was to say okay learn something else new buttons don't have to

  6. be in the form and Bam look at that it just works and this it still runs the same method that we attached within Live Wire the same wire submit method because it's linking to that particular form to submit that form so buttons don't have to be in the form but any button in the form is also automatically a submit

  7. button you don't have to have the type submit so I learned something new

just you here