Best way to test if nothing selected in WebRadioGroup

I often default groups of radio buttons to have no default value–having no default works great for situations where you want to visually show that the user hasn’t selected anything yet (such as a survey question or numerous business scenarios).

I don’t want to hard-code the positions of the buttons because I want to maintain the freedom to quickly/instantly re-arrange the layout of options without needing to change any code. I’ve resorted to something like the following, which is working fine for me in 2018r2, but I suspect I’m missing a better way:

if myWebRadioGroup.SelectedCell.left=-1 then ''''NOTHING SELECTED YET, SO DO SOMETHING APPROPRIATE elseif myWebRadioGroup.SelectedCaption="Option x" then ''''DO OTHER STUFF THAT'S APPROPRIATE FOR OPTION X elseif myWebRadioGroup.SelectedCaption="Option y" then ''''DO OPTION Y APPROPRIATE STUFF else ''''DO STUFF FOR OPTION Z end if

I feel like there should be a quicker/easier/cleaner way. My natural inclination is to just leave out the first IF that checks the SelectedCell.left, but it turns out that checking SelectedCaption seems to crash the app if none of the radio buttons are selected. Otherwise, I’d be happy with that option…

What am I missing?

Nope, that’s how I do it.

[code]dim prSelection as Pair = rdResponse.SelectedCell

if prSelection.Left < 0 or prSelection.Right < 0 then
// No selection

end
[/code]

Is it safe to say that you can just check left or right and don’t need to check both? Is there a scenario where one is -1 but the other isn’t?

According to the documentation the pair is coordinates. If either side is -1 there’s no way there’s a selection, as the right side is the column which will be 0 in a single column radio group. I have this code deployed for a single-column scenario and haven’t had any issues.