what is clearing a checkbox?
If the data that somebody entered was false.. (so that was the value that
was entered)
and then you call clear what is then the value? still false? But that is not
cleared. That is still data
cleared to me is null not false (thats state). Why is false better then
Hi,
I am trying the make a reset button (clears all fields) with code below.
According to the class comment of Form I can call
updateFormComponentModels, however that method is not visible.
What can I do to get the desired effect? I am using wicket-1.2.4.
Regards,
Erik.
// The
why do you want to call updateFormComponentModels?
You also want to clear all model data? So the models already did get some
data from a previous request?
(i take the reset button has setDefaultFormProcessing(false) ?)
but why not do this:
form.visitChildren(FormComponent.class, new
Yes, correct. The model should be cleared as well.
And it indeed uses setDefaultFormProcessing(false).
The approach your describing below will throw exceptions for checkboxes:
WicketMessage: unable to set object null, model:
Model:classname=[wicket.model.PropertyModel]:attached=true:[EMAIL
yes we can't convert null to a primitive (int or boolean)
because what is null for an int? (0? but that is wrong, it is not 0 it is
void)
For a boolean we could say null is false. But that would then be an
exception to the rule.
So you need your own converter on the object that can handle null
Johan,
I got it working as below. Shall I create a Jira issue for this? I think
it would be more logical if checkbox could deal with cleared input.
Erik.
// The reset button
Button resetButton = new Button(resetbutton) {
/** [EMAIL PROTECTED] */
my checkbox works fine:
class MyDataObject
{
Boolean myBoolean;
void setMyBoolean(Boolean b)
Boolean getMyBoolean()
}
so it is not directly the checkbox. But if you map it to a boolean
(primitive) then you don't have
the three-state thing yes. (null, false, true)
So i dont know if this is a
Hi Johan,
Ok, I understand.
Indeed, my model is a property in a bean that has the primitive type
boolean.
Even though I have a workaround now, I would appreciate such a fix.
If nobody disagrees I am happy to make a JIRA issue for it.
Regards,
Erik.
Johan Compagner schreef:
my checkbox
Keep it as current. If you want tri-state logic, then you have to
implement that. What are you going to do with int, long, double,
float? make it 0? make it -1?
Defaulting to false is very context dependent, and shouldn't be
implemented as such.
Martijn
On 1/9/07, Johan Compagner [EMAIL
The point is that I do not want tri-state logic. That is why the
property has type boolean and not Boolean. If you want tri-state logic,
you can (and intuitively will) use non-primitive properties in your
model objects.
Anyway, you could always use the same values as java uses to initialize
Okay, I thought about a bit more and I now agree with you. It will be a
mess if you do what I propose in combination with not allowing the empty
string through validation.
Still, the method CheckBox#clearInput() does not do what you expect. I
expect it to clear the checkbox. This is translated
11 matches
Mail list logo