A new valve for regulating the flow of liquid has two housings that are removably attached to one another. When the housings are separated, the liquid can no longer pass through the valve. A system of magnetic elements is used to cycle the flow of liquid (urine) through the valve. The valve is typically connected to an indwelling bladder catheter and the valve allows the patient to be at least temporarily disconnected from a collection bag.