Complex FormPanel data?
See original GitHub issueLet’s say I have a data class that looks like:
@Serializable
data class MyData(val myInt: Int, val myNestedData: NestedData)
@Serializable
data class MyNestedData(val myString: String)
Is it possible to have FormPanel
represent the MyData
class directly? Or do I need to unwind this data class such that it looks like:
@Serializable
data class MyFormPanelData(val myInt: Int, val myNestedData_myString: String)
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
Form Design for Complex Applications | by Andrew Coyle
This article illustrates 13 different ways to present forms and explores the future of data input. Modal. Simple modals work well for forms...
Read more >How to Implement Complex Form Data?
I'm looking for best practices on how to upload and send such a complex form with potentially dozens of songs to the server....
Read more >Pass complex data from form submit? - Stack Overflow
I have a array of objects that each have like 5 fields and I want to send that array on a form ......
Read more >Solved: Display complex data in Sharepoint Form
Solved: I have two use cases where I'm storing sets of data as a JSON array in a multi-line text field. I do...
Read more >complexData of ui.form, Properties Webix Docs - Documentation
complexData. enables complex data parsing mode. boolean complexData;. Example. var form = webix.ui ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Form<K>
class usesMap<String, FormControl>
internally to keep the data and it needs to createK
class somehow (in thegetData()
method). We cannot just create an instance of genericK
class in Kotlin nor in JS. Early implementations of KVision’sForm
class required model class properties to be delegated to Map and required additional factory function in the constructor (see how it looked: https://github.com/rjaros/kvision-examples/blob/4c8553f91f9bb2f7b5df0255c56e1aec14963bc9/showcase/src/main/kotlin/com/example/FormTab.kt). Then I found out kotlinx.serialization had aMapper
class, which allowed to createK
instance automagically, as long as it’s serializable. So I’ve integrated this solution, and the serialization requirement is a lot better than the previous one. I’m not sure it can be dropped without sacrificing the functionality, but I’m open to any suggestions.If the nested class has only one property (like in your example) it probably could be done with some effort. But if there are more properties I see no way to reference them and add form controls for them (
FormPanel.add
takes a field reference as a parameter).The only thing I can imagine is to implement nested forms - such nested classes could be automatically mapped to nested forms. But it would be hard and would take a lot of work. It’s not impossible but I’m afraid it won’t be done anytime soon.