RadioGroup getValue 没有返回正确的选定值 [英] RadioGroup getValue does not return correct selected value

查看:34
本文介绍了RadioGroup getValue 没有返回正确的选定值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了 RadioGroup 的一个小问题.我的 RadioGroup 具有 true 和 false 值.我的 radiogGroup 中的 Radio 类型使用一个存储 true 或 false 的模型.

I'm running into a small issue with RadioGroup. My RadioGroup has the values true and false. The Radio types I have in my radiogGroup use a Model that stores true or false.

在 Ajax onChange 事件上,我想做一些处理,为此我需要知道我的 radioGroup 和另一个相同的 radioGroup 中选定的收音机.问题是 getValue() 只从我的 POJO 返回初始值.每当我单击单选按钮更改选定的 Radio getValue() 时,它仍会返回初始值.

On an Ajax onChange event I want to do some handling, and to do so I need to know the selected radio in my radioGroup and another identical radioGroup. The problem is getValue() only returns the initial value from my POJO. Whenever I click on a radio button to change the selected Radio getValue() it still returns the initial value.

当我保存更改时,我的 POJO 会获得正确的值.我觉得这很奇怪,我花了好几个小时试图弄清楚我错过了什么.

When I save my changes, my POJO gets the correct value. I am finding this bizarre, I have spent hours trying to figure our what I'm missing.

推荐答案

如果您只需要在后端处理一些数据,我建议您覆盖 wantOnSelectionChangedNotifications() 方法RadioGroup 对象,然后使用 onSelectionChanged() 方法(再次来自 RadioGroup)来处理基于 newSelection 的逻辑,你在方法中作为参数接收.

If you only need to handle some data in the backend i would suggest you override the wantOnSelectionChangedNotifications() method of the RadioGroup object and then use the onSelectionChanged() method (again from the RadioGroup) to handle the logic based on the newSelection witch you receive as parameter in the method.

如果您想更新界面,您需要使用 AjaxFormChoiceComponentUpdatingBehavior 女巫让您可以访问 AjaxRequestTarget,以便您可以更新视图.

IF you want to update the interface the you would need to use the AjaxFormChoiceComponentUpdatingBehavior witch give you access to AjaxRequestTarget so you can update the view.

这篇关于RadioGroup getValue 没有返回正确的选定值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆