Riding positions are solely based on balance. It's kind of like an automatic balance-the-scale system. The center of the saddle is the pivot point. So, for example, if you move your legs back, your upper body will automatically come forwards to balance your weight.
The chair seat is usually caused because the rider is sitting too far back on their butt instead of on their seat bones. Your seat bones are basically what they sound like: bones that you sit on. But in order to sit on them, you need to roll your hips forward. You should feel it when you're sitting correctly.
Just by doing this, you are encouraging your leg to slide back and beneath you. If you try to bring your legs under you when you are sitting too far back, it will be uncomfortable and unsafe because you are unbalanced. Fix the way you are sitting and it will become much easier to bring it back.
Once you've fixed the problem of your seat, focus on dropping the weight into your heels. Make sure you are not gripping with your knees, which is another common cause of the chair seat. Also, remember always: balance. If your leg still
slides forward, consider the possibility that you may be tipping backwards with your upper body. If this is the case, try to lean forwards a bit.
But remember: it's not going to be extremely easy. When riding in chair seat, you are slacking. You are depending on other parts of your body like your knees and butt instead of using your muscles. When you start riding properly, you're muscles are probably going to be fairly weak and very sore. But keep at it, and pretty soon you'll gain the muscle you need to continuously ride correctly. It all comes with practice.
These are the basic reasons of why you could be sitting in chair seat, but of course it would be much easier to identify the core problem if we could see some pictures. That way, we could tell you exactly what the problem is and exactly how to fix it. Post some as soon as you can.
Hope I was helpful.