question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error when trying to use .onAdd

See original GitHub issue

Hi, I tried adding an ‘Add Members’ button on your demo form.

<button type="button" onClick={e => form.$('members').onAdd(e)}>
  <i className="fa fa-plus-circle" data-tip="Add Members" />
</button>

I get the following error: Uncaught Error: The selected field is not defined (firstname)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
foxhound87commented, Nov 9, 2016

I recently implemented pathToFieldsTree method, which we can use to create an object tree starting from a string path: https://github.com/foxhound87/mobx-react-form/blob/fb0eb6a535bd6f52c5c355409ee3cc02b9a1c61e/src/FieldParser.js#L16

I think we can start from here to create the object with empty fields for each of the path struct we need to add.

2reactions
itaylorwebcommented, Nov 3, 2016

@foxhound87 This is great thanks. Works perfectly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: props.onAdd is not a function React - Stack Overflow
I tried adding onAdd={() => addTodo()} , however, it did not work. I would like to know why the error is occurring and...
Read more >
t.onAdd is not a function - GIS Stack Exchange
I am getting an error when using map ...
Read more >
Sortable - onAdd event get all items - DevExpress Support
Hello there, I use your KanBan demo example to move items from one list to another. In one list, I use the onAdd...
Read more >
Extending Leaflet, New Layers - Leaflet - Leaflet
In our example, we ignore those and simply use a random number to get a different kitten ... when an image has been...
Read more >
runtime error: invalid memory address or nil pointer dereference
Doc Text: Cause: Eventrouter was not able to handle events of type "Info" or other event types unknown to it. Consequence: Eventrouter would...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found