it is not possible to do names(NULL) <- value, so return early when choices is NULL

https://groups.google.com/forum/?pli=1#!topic/shiny-discuss/K7chwrMCvkU
only do mapply() when length(choices) > 0, otherwise options = list(), and this will lead to an empty checkbox/radio group
pass the selected value(s) to checkbox/radio group
fixes #176: the problem of choices=NULL also affects selectInput()
per suggestion of @wch, we do not pass the selected/checked status in the message; the selected values are in message$value, and they will be set via this.setValue(el, data.value) in receiveMessage() in shiny.js

also note that updateSelectInput() is essentially the same as updateCheckboxGroupInput() now, because it does not matter if the attribute name is 'selected' or 'checked'
`selected` refers to values instead of labels/names of `choices`

added validateSelected() for backward compatibility
roxygenize
update JS tests accordingly

note that getState() no longer includes state.options.selected/checked, which is actually redundant since there is state.value
news for #340
yes, it is weird to select by names instead of values; now the weirdness has gone
also include input ID in the warning message, per suggestion of @jcheng5
move assignments out, per suggestion of @hadley
an extra )
and a missing )
a missing space
cosmetic changes, just because Github is not aware of my new commits for the PR after it was down
Merge pull request #340 from yihui/bug/null-choices

fix the bug when choices=NULL in updateCheckboxGroupInput()