gpt4 book ai didi

select - 多次选择:值未存储在相关对象中

转载 作者:行者123 更新时间:2023-12-02 15:30:02 24 4
gpt4 key购买 nike

我有多个选择,如下所示:

<g:select name="receiptItems" from="${HealthService.findAllByDoctor(Doctor.findBySecUser(new ReceiptController().getCurrentlyLoggedUser()))}"
multiple="multiple" optionKey="id"
optionValue="${{it.healthServiceType.healthService}}"
size="5" value="${receiptInstance?.healthServices*.id}" class="many-to-many"
onchange="${remoteFunction(
controller: 'Receipt',
action: 'sumReceiptItems',
params: '\'receiptItemsSelected=\' + jQuery(this).val()',
onSuccess: 'updateTotalAmount(\'totalAmount\', data, \'00000\')')}"/>

每次选择后,使用 remoteFunction,将调用 Controller 中的方法进行一些计算并更新totalAmount字段。它工作正常,但是,当调用 save方法时, healthServices字段为null ...而且我不明白为什么。
我也尝试过
receiptInstance?.healthServices.collect{it.id}

但我有相同的结果。
有什么建议吗?

最佳答案

您将选择标签命名为“ receiveItems ”,因此在Controller中检查该参数,然后将其添加到receiveInstance:

params?.receiptItems?.each {
def service = HealthService.get(it)
receiptInstance.addToHealthServices(service)
}

关于select - 多次选择:值未存储在相关对象中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20921407/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com