In situ tetrazole ligand synthesis leading to a microporous cadmium-organic framework for selective ion sensing.