Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

React Cookbook: Tracking changes in an antd form

 
Ranch Hand
Posts: 861
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
D & D,

Another newbie question -- I'm working on an inherited (from another developer) browser app that has a data entry form that can be used to either create a new request or edit an existing one. It uses the antd library for the various fields and I've been asked to modify the code so that when the user is editing an existing request, the Save button is disabled unless one or more of the fields has been changed.  This makes sense but I'm concerned about keeping track of whether or not anything has changed.  When the user is editing an existing request, I have access to the original data returned by a web service, so I could make use of each field's onChange method and compare it's current value with the original, but I'm hoping there's a better way. Any suggestions?

Thanks,
Burk
 
Sheriff
Posts: 67592
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You don’t need to keep track of touched values yourself; antd will do that for you and pass the information to the form handlers. antd also has form validation that you can leverage.

Check out the examples on the Form page for details. Granted, the antd documentation is not the best, but you should be able to find what you are looking for.
 
Author
Posts: 115
10
Android Python Ruby
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree with Bear
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic