Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

MyFaces Tomahawk ignores checkbox in dataList on first submission  RSS feed

 
Wally Hartshorn
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We're using MyFaces with Tomahawk and are seeing some strange behavior that appears to be related to t:dataList and certain types of form elements.

Suppose you have a form with code like this:


Note that one checkbox is outside of the dataList, the other is inside the dataList.

Suppose I were to do this:
  • display the form
  • select both checkboxes
  • click submit
  • I would find that the value of the checkbox that is inside the t:dataList is ignored -- the value of myBean.boxInDataList would NOT be set to "true". The checkbox outside of the t:dataList would work just fine.

    Stranger still, if I were to:
  • display the form
  • select both checkboxes
  • do something that will cause a validation error (e.g. leave a required field blank)
  • click submit
  • Then I would find that when the form was redisplayed with the validation error message, the checkbox within the t:dataList would NOT be checked. The checkbox that is outside of the t:dataList would properly remember that I had checked it.

    Strangest of all, if I were to:
  • display the form
  • select both checkboxes
  • do something that will cause a validation error (e.g. leave a required field blank)
  • click submit
  • observe on the redisplayed form that the checkbox in the t:dataList is not checked
  • reselect the checkbox
  • correct the validation error
  • resubmit the form
  • Then I would find that the value of the checkbox in the t:dataList is NO LONGER IGNORED.

    What the...?

    Is this a bug in MyFaces Tomahawk or is there something subtle going on here that I'm missing?
     
    It is sorta covered in the JavaRanch Style Guide.
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!