Тёмный

Create Dynamic Form Fields in React 

Cand Dev
Подписаться 15 тыс.
Просмотров 101 тыс.
50% 1

By creating dynamic form this will help if you don't know how much input fields user want, and we are going to use Material-UI just for make it little bit loot nicer.
Code: github.com/candraKriswinarto/...
Material-UI : material-ui.com/getting-start...
Support The Channel:
paypal.me/canddev
🌎 Find Me Here:
Instagram : / candra_kriswinarto
GitHub: github.com/candraKriswinarto/
Linkedin: / candra-kriswinarto
------------------------------
Levity by Johny Grimes / johny-grimes
Creative Commons - Attribution 3.0 Unported - CC BY 3.0
Free Download / Stream: bit.ly/2sUZMCR
Music promoted by Audio Library • Levity - Johny Grimes ...
------------------------------
#dynamicForm #React #enjoyCoding

Наука

Опубликовано:

 

18 июл 2020

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 106   
@xxfce11
@xxfce11 3 года назад
With splice() function in your handleAddFields() handler you will be able to add new fields in beetween existing fields, not only at the bottom like you've done it. Try this: handleAddFields(index) { const fields = [...this.state.inputFields]; fields.splice(index+1, 0, { firstName: "", lastName: "" }); this.setState({ inputFields: fields }); } The difference is I work with class-based component here. Also note that you have to pass index into the event handler. By the way - excellent tutorial, helped me a lot :)
@khandoor7228
@khandoor7228 4 года назад
awesome job CanDev I have been looking for an example of this for a while!!!
@Bluesmile84
@Bluesmile84 3 года назад
Precise, Excellent and very useful video for beginners. Good work.
@mewsnetics
@mewsnetics 2 года назад
This is exactly what I was looking for. Thank you so much.
@ajaybedre4199
@ajaybedre4199 3 года назад
Very Very useful ! I struggled lot and got landed here, Thank you!!
@yemmeth
@yemmeth 4 года назад
That's a great tutorial! Helped me lots with my current project
@bahiaanis331
@bahiaanis331 3 года назад
so what's your work thank you
@nijarshrestha3745
@nijarshrestha3745 3 года назад
Great tutorial, helped me a lot with my current project.
@MrJacques5656
@MrJacques5656 Год назад
Very slick piece of coding and saved me a ton of time. Thank you!
@mikealejandro3938
@mikealejandro3938 3 года назад
Broh, this was dope, you the greatest !
@malshamadushani5456
@malshamadushani5456 2 года назад
This is a great tutorial! Well explained.
@user-kj9zc9nc6h
@user-kj9zc9nc6h 3 года назад
Keep on going man. Useful tutorial
@durgeshjhalwa6639
@durgeshjhalwa6639 3 года назад
Best video for dynamic form really awesome ,Thank you so much for this video
@samsonwong8242
@samsonwong8242 3 года назад
Excellent Detailed Example !!
@rohittewari6902
@rohittewari6902 Год назад
Thank you so much for helping me out. I was finding the solution for 2 days❤
@Human_Evolution-
@Human_Evolution- 2 года назад
Very awesome. I think I'd prefer it without the styling but I love it. Great job.
@joaquinpettinari200
@joaquinpettinari200 3 года назад
I just see the code and it works, thanks!!!!!! You have a new suscriber
@maingocdieptran2489
@maingocdieptran2489 3 года назад
Thank you so much... It helps me a lots! 😀
@giantqtipz6577
@giantqtipz6577 3 года назад
This is a pretty easy to follow tutorial
@sultanalmuhon9
@sultanalmuhon9 3 года назад
It helped a lot. Thanks, man
@sweetshoez
@sweetshoez Год назад
I was stuck on this sort of problem (but I wanted to render a dynamic number of fields based on user input) for hours. I could get the forms to render but I could not figure out how to watch a dynamic number of inputs in state AND having a way to access their unique values. I tried to do what I wanted with your pattern, and I could probably figure it out eventually but this worked and is great in its on way. Thank you
@santhoshmichael6771
@santhoshmichael6771 2 года назад
This video is the best video we apply this in many ways thank you for this video....sir...... it was applied by me in my live project in many places such a essential video for all ........thank you very much for this video
@madhu1591
@madhu1591 Год назад
Hello, I want to store and persist the data entered in this dynamic form fields into local storage. Do you have any idea about it.
@DidYouKnowThis.
@DidYouKnowThis. 3 года назад
Thank you so much..This is a very useful project.
@vimalswaroopj3429
@vimalswaroopj3429 2 года назад
Great!!! Thanks for the video :)
@sarathchandran2815
@sarathchandran2815 3 года назад
Awesome tutorial. Subscribed
@gourabpaul3560
@gourabpaul3560 2 года назад
you are a lifesaver, I cant thank you enough.
@nezgi8220
@nezgi8220 2 года назад
thanks a lot man! awesome tutorial
@roopapalanisamy3054
@roopapalanisamy3054 3 года назад
Thanks for the precise video
@nicpenaloza
@nicpenaloza 2 года назад
Great tutorial! Thanks
@parhamabolghasemi5123
@parhamabolghasemi5123 2 года назад
please post more videos like this, it was perfect thanks 🙏🙏🙏❤❤
@MarcelaVilasBoasCharchar
@MarcelaVilasBoasCharchar 4 года назад
Thank you very much! Help a lot!
@kazalghosh5598
@kazalghosh5598 2 года назад
Thanks a lot.. It helps my current project..
@tuna3539
@tuna3539 3 года назад
I appreciate you bro , you saved my time.
@teeratphoowaborwornphimkul3501
@teeratphoowaborwornphimkul3501 2 года назад
You are real master ... !!! Cool Resource Thank a lot .... Bro
@DhiaMagicien
@DhiaMagicien 3 года назад
Excellent tutorial
@thecensorguy1237
@thecensorguy1237 3 года назад
worked like a charm
@ashwinim2391
@ashwinim2391 3 года назад
Helpful.. thanks ☺️
@mdkhairul4640
@mdkhairul4640 2 года назад
Simply Wow. Thank You. Jajak Allah khaier.
@derickfabert9681
@derickfabert9681 3 года назад
Great video... I have been having trouble with this for a few weeks now. I have a problem where the cursor blurs after I enter each character. Any ideas?
@rohan1765
@rohan1765 3 года назад
Thank you , that was perfect 👍🏻
@al-mokhtar_
@al-mokhtar_ 3 года назад
putin learning to code !!! why?
@jakecheek1359
@jakecheek1359 3 года назад
This helped a lot thanks
@edspressomartini
@edspressomartini 3 года назад
very cool thanks sir!
@Maybehassanawad
@Maybehassanawad 3 года назад
You helped me a lot
@yloibx
@yloibx 2 года назад
great tutorial man...
@rushikeshfukat7191
@rushikeshfukat7191 2 года назад
Perfect one
@muhammadabbas5365
@muhammadabbas5365 3 года назад
Thanks for the video bro, can u share how to submit all the data in post api controller?
@eanditefera2794
@eanditefera2794 2 года назад
Thank you, the video helped me a lot. Also, Why when i try get current inputFields within useCallback, i get only one item and not the rest of items?
@ams4825
@ams4825 3 года назад
Hi. Could you advise on how to validate those new fields with Joi?
@kapiljain4423
@kapiljain4423 Год назад
i need to use grid in my project,shall i go for ag-grid community version? please suggest.
@g.bagiryan
@g.bagiryan 3 года назад
Thanks for this video man, really helpful. Could you help me with a question though? Say I have the same structure except the fields are called Key and Value and I also have a selector for value type which can be a nested object with the same Key value fields. How would I collect all that data into one nested json object? What I did is whenever i pick value type as an Object, I recursively draw the same component, but I couldn't figure out a good way to transfer child objects data to parent. If i do it on onChange event the number of rerenders for a single input is crazy...
@voidsid5381
@voidsid5381 3 года назад
Great!!! Thank you
@sharkman6434
@sharkman6434 2 года назад
meannnnn very very very great big more big and very big special thanks for you and you video !!!!
@deejiw
@deejiw 3 года назад
thank you for sharing
@feddagmohammedzineddine3272
@feddagmohammedzineddine3272 3 года назад
hello , i havn't find the source code on the git repo you shared , may i know where is the problem
@lakshaychauhan9190
@lakshaychauhan9190 2 года назад
Hi, very good tutorial. So I am trying to add dynamic fields in my project and splice function is working as expected in managing array but, it always removes input field from the last and does not also update in UI . any help
@oskki8752
@oskki8752 Год назад
I've got a problem with component from Material UI, as it does not support onChange, when clicking on dropdown MenuItems. Anyone got idea, how to actually dynamically change the value of the Select component ?
@ngocduy1848
@ngocduy1848 3 года назад
thank u so much!
@asmabenbrahem6
@asmabenbrahem6 4 года назад
thank you !
@kacperkepinski4990
@kacperkepinski4990 2 года назад
do you have live version? Is it editable?
@tanishqgaba5697
@tanishqgaba5697 3 года назад
What if instead of input field , we want a by default defined dropdown list?
@ravikirun6783
@ravikirun6783 3 года назад
Fantastic
@ignasave
@ignasave 3 года назад
Dude you saved me with my proyect
@bayusarifudin6525
@bayusarifudin6525 2 года назад
why cant I type any characters in the form inputs? i just set it exactly like you did in the video, but the value is really can not be changed
@EmbeddedClub
@EmbeddedClub 2 года назад
how you can avoid deleting the last/first field?
@gianlucasantos3302
@gianlucasantos3302 3 года назад
Could you maybe show how to validate this form ? Like with yup we can define a Schema for the validation, but how would we do this with a dynamic form ?
@vijayvj9441
@vijayvj9441 2 года назад
any suggestions for dynamic dropdowns like this
@shohagkhan3677
@shohagkhan3677 3 года назад
Thanks for this important tutorial. It will be very much effective for us, if you show how to submit this data using express or laravel rest api.
@madhu1591
@madhu1591 Год назад
I want to store and persist the data entered in this dynamic form fields into local storage. Can anyone please help me with that
@nadiafirly4671
@nadiafirly4671 3 года назад
Thankyou
@abolirode
@abolirode 3 года назад
can you tell how to perform this using formik
@rbisoi6
@rbisoi6 3 года назад
1000th Subscriber YaY
@nikhilrajbhar7980
@nikhilrajbhar7980 3 года назад
thank you..
@xinwang350
@xinwang350 3 года назад
Hello sir, one problem about the code I found by the help of eslint is index shouldn't be used as key. quote: "ESLint: Do not use Array index in keys(react/no-array-index-key)" ref1: stackoverflow.com/questions/46735483/error-do-not-use-array-index-in-keys ref2: github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-array-index-key.md any idea of how we can modify the code to avoid this?
@CandDev
@CandDev 3 года назад
You can use uuid to generate the id, and use the id for every object in state { id: uuid(), firstName: '', lastName: '' }, or just pull my code in description, i have new commit for that. :)
@rawalpindiupdates
@rawalpindiupdates 3 года назад
Can you please show how to submit this data to API ?
@suraj3326
@suraj3326 2 года назад
hey man at 22:15 if you pause, can you explain why event.target.name is inside a [ ] bracket
@Mjiujtsu
@Mjiujtsu Год назад
This is pretty much what i've done except if I remove the fields in the middle of the form, not from the end like you then the inputs become uncontrolled and lose sync with state
@khandoor7228
@khandoor7228 4 года назад
Question: what is the rule for when you call a function like this: onSubmit={handleSubmit} and like this onClick={ ( ) => handleAddFields} ? when do you use one or the other?
@CandDev
@CandDev 4 года назад
if you want to pass a parameter to event handlers, you should use ={() => fn}
@khandoor7228
@khandoor7228 4 года назад
@@CandDev TY!
@kapiljain4423
@kapiljain4423 Год назад
Hello Sir, your lectures are awesome and very helpful. I am beginner. I tried to edit code and replace textfiled with Autocomplete but it is working but autocomplete filed return empty values. i need your help.
@ericng3673
@ericng3673 3 года назад
If u remove anything in the middle, it does not actually remove the middle one but always the last one
@aaminbaig1224
@aaminbaig1224 3 года назад
Good video , but there's an issue. If you delete a row that exists between the 1st and the last row, it still deletes the last row. Please cross check with that.
@ykasiu
@ykasiu 3 года назад
I spend three days to find out how to do that!
@gamingemail9332
@gamingemail9332 3 года назад
question: how to handle if there's nested object or array inside that??? if let say one text field is for { name:"Joe", gender:"male", extra:{ height: , } }
@g.bagiryan
@g.bagiryan 3 года назад
Hey man did you figure it out?
@afridirahman5464
@afridirahman5464 2 года назад
Please make another tutorial on creating dynamic input fields in Dynamic Forms
@kapiljain4423
@kapiljain4423 Год назад
Hi, It would very helpful if you also add validations. Thanks in advance.
@danielpreza4159
@danielpreza4159 3 года назад
but, there is a mistake if you start to delete each element from first to last (up to down)
@arsalanbabar1078
@arsalanbabar1078 Год назад
How to fix that issue?
@RahulRai-pd9xd
@RahulRai-pd9xd Год назад
please make nested dynamic form like we can add any no. of questions with any no. of options in it...thanks for the video...
@AZ-vu7sb
@AZ-vu7sb 3 года назад
values[index][event.target.name]=event.target.value could you explain....
@akhileshraou9529
@akhileshraou9529 2 года назад
would have been great if u had done form validation too!
@Human_Evolution-
@Human_Evolution- 2 года назад
Yup
@santhoshmichael6771
@santhoshmichael6771 2 года назад
Sir please create a examination project in react.....
@Fuzkin
@Fuzkin 3 года назад
Test the mic before filming. Distracting
@guruprasadsali7402
@guruprasadsali7402 2 года назад
naming conventions is so confusing correct it and never do this mistake , u always add s at the end of variable
@davidmchale2514
@davidmchale2514 3 года назад
great video, but a horrible way to use css.
Далее
Create react projects
22:33
Просмотров 40 тыс.
React Hook Form Tutorial - 15 - Dynamic Fields
9:35
Просмотров 63 тыс.
The Story of Next.js
12:13
Просмотров 560 тыс.
React Forms: the SIMPLEST way
8:12
Просмотров 20 тыс.
React Form Array Data
15:01
Просмотров 44 тыс.
📱магазин техники в 2014 vs 2024
0:41