php - Table data inside forms is not saving - Stack Overflow

admin2025-04-16  7

I tried out a new version of Hubleto and wanted to use some of it's forms. But I later found out the data in tables inside forms is not saving.

I decided to dig around and found out the relation data (an array of objects) in the Form.tsx in the saveRecord() method is deleting itself when it's being transferred into the record variable.

The data looks similar to this:

{ 
 id: 1,
 PRODUCTS: [
  {id: 1}, 
  {id: 2}
 ]
}

It happens at this line specifically:

let record = { ...this.state.record, id: this.state.id };

Any idea of why it's happening?

I tried out a new version of Hubleto and wanted to use some of it's forms. But I later found out the data in tables inside forms is not saving.

I decided to dig around and found out the relation data (an array of objects) in the Form.tsx in the saveRecord() method is deleting itself when it's being transferred into the record variable.

The data looks similar to this:

{ 
 id: 1,
 PRODUCTS: [
  {id: 1}, 
  {id: 2}
 ]
}

It happens at this line specifically:

let record = { ...this.state.record, id: this.state.id };

Any idea of why it's happening?

Share Improve this question edited Feb 13 at 7:03 Rindo789 asked Feb 3 at 13:28 Rindo789Rindo789 214 bronze badges 3
  • 3 Please edit your question to include a minimal reproducible example so that readers can run your code to answer your question. – DarkBee Commented Feb 3 at 13:30
  • What specifically is this line of code doing that you don't expect? What does this.state contain before this line of code? What does record contain after this line of code? What different result were you expecting it to contain and why? – David Commented Feb 3 at 13:46
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Bot Commented Feb 3 at 22:14
Add a comment  | 

1 Answer 1

Reset to default 0

Most probably your form description did not contain includeRelations property. Check the Description API: https://developer.hubleto.com/advanced-development/description-api/form

转载请注明原文地址:http://www.anycun.com/QandA/1744769361a87365.html