react-json-editor icon indicating copy to clipboard operation
react-json-editor copied to clipboard

referencing property changes

Open varunagg45 opened this issue 9 years ago • 0 comments

I have a requirement that the value of the field depends on the value of another field. eg.

schema = {
  title      : "My pretty form",
  description: "Declarative pure data DSLs are the best.",
  type       : "object",
  properties : {
   
   comments: {
      title      : "Your comment",
      description: "Type something here.",
      type       : "string",
      minLength  : 1
    },
    
    anotherField: {
      title      : "autocomplete",
      references: ['comment']                                               // new property
      description: "auto",
      'x-hints': {
        'form': {
          'inputComponent': 'async-autocomplete'
        }
      }
    }
 }
};

Now i added references something new to the above schema. My requirement is that this custom component can have a listener that can listen to any changes to the fields mentioned in references, in above case any change made to comments field should trigger a listener in anotherField. Can someone help me with this?

varunagg45 avatar Jan 19 '17 02:01 varunagg45