Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]custom的value显示 #638

Open
Kuwagata0 opened this issue Sep 10, 2024 · 0 comments
Open

[BUG]custom的value显示 #638

Kuwagata0 opened this issue Sep 10, 2024 · 0 comments
Labels
🐛bug Something isn't working

Comments

@Kuwagata0
Copy link

Bug Description [describe the bug in detail]

我在formlist中尝试addtable(...,...,func(pa *types.FormPanel) {}),对于pa这个表单addfield custom类型,在按照官方文档可以在CustomContent中,使用这样的模板语法来表示编辑时字段的值:{{.Value}}
但实际并没有解析{{.Value}}

How to reproduce [describe the steps how to reproduce the bug]

formList.AddTable("场景内容", "context", func(pa *types.FormPanel) {
pa.AddField("场景第一句话文案", "greet_text", db.Text, form.Custom).FieldMust().FieldHideLabel().
FieldCustomContent(template.HTML(<input type="button" onclick="showPopup()" value="显示"> <input required="1" type="text" name="greet_text" value="{{.Value}}" class="form-control greet_text" placeholder="输入 场景第一句话文案">)).
FieldDisplay(func(value types.FieldModel) interface{} {
if _, ok := value.Row["bot_id"]; !ok {
return []string{""}
} else {
contextFirstTexts := []string{}
for _, item := range botContextAllRecords {
if item.Status == "UP" {
decData := utils.DecodeBase64(ctx, item.GreetText)
if decData == "" {
logger.WarnCtx(ctx, "error decoding")
}
contextFirstTexts = append(contextFirstTexts, decData)
}
}
if len(contextFirstTexts) == 0 {
return []string{""}
}
return contextFirstTexts
}
})
}).FieldInputWidth(20).FieldMust()
image

Expect [describe your expect result]

显示数据库中正确的信息而不是未解析的Value

Reproduction code [here to show your codes or examples]

Versions

  • GoAdmin version: 1.2.26[e.g. 1.0.0]
  • golang version 1.20.6
  • Browser: Microsoft Edge
    版本 128.0.2739.67 (正式版本) (64 位)
  • OS [e.g. mac OS]
  • Linux

Others [screenshots or others info here]

@Kuwagata0 Kuwagata0 added the 🐛bug Something isn't working label Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant