I dig into 1.3 trunk, and yes, in FormTester constructor:

*else* *if* ( (formComponent *instanceof* DropDownChoice) ||
            (formComponent *instanceof* RadioChoice) ||
               (formComponent *instanceof* CheckBox))
{
 setFormComponentValue(formComponent, formComponent.getValue());
}

current implementation does not consider null model object.  I think
possible fix is:

*else* *if* ( (formComponent *instanceof* DropDownChoice) ||
            (formComponent *instanceof* RadioChoice) ||
               (formComponent *instanceof* CheckBox))
{
 if(formComponent.getModelObject() == null)
 {
    setFormComponentValue(formComponent, formComponent.getValue());
 }
}

and It seems FormTester lack support for RadioGroup while construction,
(only CheckGroup supported).


On 6/7/07, severian <[EMAIL PROTECTED]> wrote:


I'm having a problem with DropDownChoice components & FormTester.  I've
declared my DropDownChoice as required, which works fine via the browser -
the correct validation feedback is given when I fail to make a selection.

However, when trying to write a test demonstrating this, no validation
feedback is given.  It seems that when using the browser,
FormComponent.checkRequired() is given the input as "" (empty string), and
so correctly declares this as invalid.  But when using FormTester,
FormComponent.checkRequired() is given the input as "-1", and so correctly
declares this as valid.

This smells like a bug somewhere inside FormTester - the value "-1" should
not be set for a DropDownChoice with no selection.  If I call
FormTester.setValue(dropDownId, "") before calling FormTester.submit(), I
get the desired behaviour, but obviously that's pretty ugly.  Anyone got
any
ideas or should I raise a JIRA?
--
View this message in context:
http://www.nabble.com/FormTester%2C-DropDownChoice---Validation-tf3884382.html#a11009710
Sent from the Wicket - User mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user




--
Ingram Chen
��便��啦: http://dinbendon.net
blog: http://www.javaworld.com.tw/roller/page/ingramchen
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to