Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Support form and table field widget customization with FieldWidget #1204

@j0hnsmith

Description

@j0hnsmith

Describe the feature

I'd like a string field in a form struct to be rendered as a Chooser.

I've had a quick dig through the code and it doesn't seem possible as things stand. Essentially this equates to a larger feature request, that form field widgets can be specified via struct tags where appropriate (and in this case, enum values provided).

Code below is indicitive of what I'd like to be possible.

Relevant code

type MyStruct struct {
	SomeField string `widget:"chooser" values:"foo,bar,baz"`
}

form := core.NewForm(someFrame)
form.SetStruct(&MyStruct{}) // SomeField is rendered as a Chooser with available values of foo, bar, baz

Metadata

Metadata

Assignees

Labels

approvedThis feature request will be implementedenhancementA new feature requesthigh priorityThis issue should be resolved quickly

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions