What is a FormData Object

Поделиться
HTML-код
  • Опубликовано: 19 сен 2024

Комментарии • 68

  • @TheUndulyNoted
    @TheUndulyNoted 3 года назад +16

    Couldn't be better, I love content creators like you! No bullshit, no time wasting, just a nice simple, concise and clearly rehearsed explanation! You're awesome.

  • @purswanitarun
    @purswanitarun 3 года назад +2

    Not only did I get closer to a solution for a problem that I was facing from two days, but my God your voice is beautiful, sir.

  • @kubataiupov1245
    @kubataiupov1245 6 месяцев назад +1

    I wish found these videos earlier when I started to learn JS. Have watched tons of other sources, but most of them were just time-wasting. Thanks a lot!

  • @oah8465
    @oah8465 4 года назад +6

    Wow you are really talented at teaching. Congrats Steve, way to go :)

  • @saifhamdare72
    @saifhamdare72 Год назад +1

    Another video another learning. I always wonder how a formdata works and why cant i just console it . Here you provided us the whole structure of it. Found a channel which will definitely help getting at coding.

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  Год назад

      New video coming out today on using FormData objects and building HTML spreadsheet-like tables and exporting CSV files with the same data.

  • @armorinformationtechnology7309
    @armorinformationtechnology7309 4 года назад +1

    Awesome Steve! I've been using the FormData object for a while now and I love it. However, your very clear explanation of what it is and what it does has given me a better understanding of its implementation and options. Thank you!

  • @moustaphatoure370
    @moustaphatoure370 3 года назад +1

    Awesome cristal clear way of explaining !!!! Thanks a lot Mr Steve Griffith.... really appreciate that !!!

  • @Shaktiman-dz4vq
    @Shaktiman-dz4vq Год назад +1

    Thanks for the explanation. I did not know we can add a 3rd param for filename. It solved one issue that I was facing with appending a file with non ASII chars.

  • @quietackshon
    @quietackshon 5 лет назад +3

    ...and as always, thanks for sharing your knowledge.

  • @benzflynn
    @benzflynn 5 лет назад +5

    FormData objects at client side are straightforward enough. The real problem is extracting the data (preferably without express or other framework) at the Node server side.

  • @thenewcoder5592
    @thenewcoder5592 5 лет назад +1

    Very insightful tutorial Sir. Thanks

  • @perveznagi3213
    @perveznagi3213 2 года назад

    Every time I watch professor Steve's videos, I just like before it even starts because I know its going to be amazing. Also, just a question, why do we need the new Request object, can't we send using POST method and JSON data? Thanks for the video

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  2 года назад +1

      Whether you create a Request explicitly or use the default values there is always a Request. I use it in the samples to highlight this fact.

  • @yo1414
    @yo1414 4 года назад

    Thanks Steve - Very nice review of fromData Object!

  • @amircahyadi9219
    @amircahyadi9219 2 года назад

    Nice 👍

  • @testingaccount5867
    @testingaccount5867 2 года назад

    You are the best

  • @viktorlernt6063
    @viktorlernt6063 Год назад

    Thanks, very helpful!

  • @nikoing
    @nikoing Год назад

    This is so nice, clear and helpful.
    So, can you make a video about FormData () sending files (blob) ?

  • @valp_co
    @valp_co 2 года назад

    Thanks man....clear, precise

  • @mohsinmd2662
    @mohsinmd2662 3 года назад

    so clear about it now

  • @rotrose7531
    @rotrose7531 4 года назад

    As always, thank you very much!

  • @jatinsharma3792
    @jatinsharma3792 Год назад

    How to retrieve in Java filter ?? If I need to add the CSRF token value in FomeData payload I want this value to fetch in filter. I am getting null value everytime.

  • @jimshtepa5423
    @jimshtepa5423 Год назад

    if an object (which is instance of FormData) is sent to server is it necessary to transform it to javascript array before manipulating as per business logic? i.e. when data in the form of FormData object is arrived to server is it native javascript datatype or is it still something like html collection?

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  Год назад +1

      It is sent as a string, like JSON, and gets turned into a native datatype depending on the language on the serverside

  • @alifirhas3550
    @alifirhas3550 3 года назад

    I've been using FormData recently. I know how to use it but don't know any details about it. Now i know.

  • @neelabhdutta6691
    @neelabhdutta6691 2 года назад

    Lets say I have a todo app, can the value in [name value] again hold list of name value pairs. And if so.. how?

  • @ferneyp
    @ferneyp 3 года назад

    Gracias por la explicación. Un saludo.

  • @Bruno-ds8ze
    @Bruno-ds8ze 5 лет назад +1

    thank you for this tutorial

  • @omirosvasdaris7697
    @omirosvasdaris7697 4 года назад

    Thank you!
    It was that simple eventually.

  • @MattJonesTech
    @MattJonesTech 2 года назад

    This is probably a dumb question, bu here goes:
    is there a nice way of taking HTML form data with different input types (text, email, phone, select, etc) and putting it inside the FormData object and print the results as JSON without having to fd.append every single input by hand?

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  2 года назад +1

      I've got lots of videos on putting data into formdata objects or plain objects and uploading it.
      Here are a few:
      ruclips.net/video/JtKIcqZdLLM/видео.html
      ruclips.net/video/GWJhE7Licjs/видео.html
      ruclips.net/video/NxVCq4p0Kb0/видео.html

    • @MattJonesTech
      @MattJonesTech 2 года назад +1

      @@SteveGriffith-Prof3ssorSt3v3 Thank you so much! This was exactly what I was looking for!

  • @codedriandotjs
    @codedriandotjs 5 месяцев назад

    If I passed the form's input data to FormData, I can do that by const formData = new FormData(this);. Do I need to use append or no?

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  5 месяцев назад

      You can pass a reference to the form to the formdata constructor. As long as each of the input elements have a name attribute then they will be included. You can use the append and remove methods to edit or add more.

  • @renatofonseca9237
    @renatofonseca9237 Год назад

    Hey, when I use a console.log at some formData, it shows an empty object, that has just a prototype pointing to the formData class. Why does that happen? Shouldn't it show the arrays of this formData as the attributes of it, like a regular object? Thanks!

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  Год назад

      FormData is not an empty object. It's just not an object literal or an object that is an instance of Object. It is a different kind of object. The variable references the FormData object.
      If you want to see the values that you have stored inside it then you need to use one of the methods like entries( ) or values( ) to get at them.

  • @angladephil
    @angladephil 5 лет назад

    Very useful video! Roughly, can I compare the formData object with the PHP's global $GET/$POST arrays ? is that concept correct ? Thank you.

  • @ABUTAHER-wg7gz
    @ABUTAHER-wg7gz 2 года назад

    Could you explain what is advantage of formData, where Every key value should be append and set etc?

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  2 года назад

      You don't have to set each value. You can also pass a reference to the form to the FormData constructor. The benefit of the append method is being able to pick and choose which field, as well as add things that aren't in the form.

  • @najihashim3997
    @najihashim3997 Год назад

    how to receive formdata in node js. without fetch or without express js

  • @AshutoshSingh-uc6nk
    @AshutoshSingh-uc6nk 5 лет назад

    Thanks for the vedio that was really usefull, can you make a vedio on "What is multipart form data" ?

  • @gabrielfono844
    @gabrielfono844 2 года назад

    thnanks
    I am having hard to send two files on the server
    I can only see two files

  • @Fshhady
    @Fshhady 2 месяца назад

    Hi Steve, it's always very usefully as usual, I am big fan.
    I have question
    what if I will use the form to submit a table of values of products. in this case, easy row is going to hold the values for one products.












    now, how to get the information for each product to display in console.log() for example?

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  2 месяца назад +1

      tbh, I wouldn't use a FormData object with a table of data like that. If you are building something like a spreadsheet of data, then each item will have a unique id, in addition to the name and price. The unique id can be placed in a data- attribute for each input OR in an input type="hidden" for each row.
      The only items that don't have an id are the ones that have not been saved in your data storage (DB) yet.
      There are lots of options for how to handle sending the data to the server.
      You can make each row into a form, since you are only going to be adding or editing or deleting the products one at a time. If you use this approach then there can be a FormData object created for each form as it is being updated.
      If you want to see or overwrite everything all at once then I would use a single JSON object instead of a FormData object. As you make changes in the form(s), you update the JSON object. You can send the JSON to the server for updates as you wish.

    • @Fshhady
      @Fshhady 2 месяца назад

      @@SteveGriffith-Prof3ssorSt3v3 many thanks my friend

  • @robings6489
    @robings6489 4 года назад

    So what exactly is the advantage over sending a regular object?

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  4 года назад

      You can't send a regular object. You have to format it into something that http and the server can handle. A formatted urlencoded query string, a JSON string, an Array Buffer, Blob, or a FormData object.
      So, the FormData object is a nice simple API to use.

  • @itachiuchiha1734
    @itachiuchiha1734 2 года назад

    nice

  • @nickleex
    @nickleex 2 года назад

    thank you ! Very clear, and i dont speak english :)

  • @johanneswe
    @johanneswe 5 лет назад

    Perfect

  • @CodingWithDilip
    @CodingWithDilip 2 года назад

    i cant send patch req using form data

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  2 года назад

      To send any of the HTTP Methods, just change the method header. This includes Put, Post, Get, Delete, Head, Options, Trace, and Patch. The only Request that has no body allowed is Trace. All the others are allowed to include a body. The body can be a FormData object (which can come from either the HTML form directly or be created through JS, a url encoded string, or any readable stream.

  • @KunglawAdy
    @KunglawAdy 3 года назад

    so if anyone ask me what is FormData in js , i answer it with its class/method from js that send data / request from a form without a tag form in html ?

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  3 года назад +1

      FormData is an object that can contain data in a special format, similar to how an HTML form holds data, in name value pairs. It can be created without a form and used to transport data to a web server through a fetch( ) call.

  • @DashFactsCentral
    @DashFactsCentral 2 года назад

    Anyone knows how to send array as data in FormData?

  • @Colstonewall
    @Colstonewall 5 лет назад

    Thanks, Steve.

  • @itayfx
    @itayfx 3 года назад +1

    Nobody gonna mention that he have 8 browsers? Lol

  • @tank3castaneda82
    @tank3castaneda82 5 лет назад

    can i marry your voice?