Dependent drop down problem... can somebody help me out

I have been trying this dependent drop down for some time. for some reason it is not working as expected,

Somebody help me…

I have attached all the images regarding the issue…

The issue is while converting for view it converts as optgroup. I just needed html option instead. That is why i guess the dropdown not populated

Please post the output of $selected (as text please, not an image).