How to drag on an straight axis

I am wondering if I can drag an object in a straight line by locking the y on an straight axis so it only drags up and down. I have the drag set up and I tried to add the straight axis by constraining the y position to a certain position on the screen (for example: 240). But it still drags normally. Any help?
Comments