Dirty flag on a HTML form is much trickier than I thought, that is, it is tricker when I started to programming for dirty flag.
1) The default selection (type “0”), or select “nothing”, I forgot to set the value “0” (string type).
2) Second, I forgot to clear some of the derivative selections when I make selection the primary selection menu (basically it will dynamically generate other drop downs based on the primary selection).
3) Third, allow type “0” has other effect, I had to remove required=”true” validation from the selection menu, and validate it manually. Also, after I made this optional (removed required=”true”), the actionListener will get triggered when I make selection type “0”, previously it was not entering it, and caused other rendering issues.
4) Last but not least, I added a “validator” to the primary selection menu (basically it will give error if I select “0” type), and it will not trigger the actionListener again. Madness. So basically I have to do the validation somewhere else.