In my experience, multi day trips to
Disneyland should always involve staying in Anaheim. At the end of the day, I'm exhausted and the less time I have to spend getting back to the hotel, the better. The furthest away I've stayed was Huntington Beach (25 minutes) because another person forced us to stay there and it was about 23 minutes too far. The drive home at the end of the day was not at all enjoyable and this was with no traffic whatsoever plus I missed the exit one night. I will never stay outside of Anaheim again. The savings were not at all worth the time and distance.
I don't live in SoCal, but I did a quick google search and found that the city of Carlsbad says that it is 63 miles from Anaheim.
If you want to maximize your time at Disneyland, I strongly recommend staying in Anaheim. You're very close to the parks in the morning hours (when headliner attractions are at their least crowded), and in the evening when you can experience the nightime shows like Fantasmic, the fireworks show, DCA's brand new World of Color and the Main Street Electrical Parade. And since days at Disneyland can be very long, staying in Anaheim makes it easier to take a mid day break if necessary or desired.
If you just want to wander around Disneyland and don't really care how many rides you go on or how long you may wind up waiting to ride them (possibly 60+ minutes for the headliners and almost all of Fantasyland), and are okay leaving either before the magic of the nighttime happens or making a long drive home at the very end of the day when you're tired, exhausted, and have sore feet, then you probably can stay in Carlsbad and make the drive to Disneyland, though you may regret it.
Many people wind up making Anaheim the base of a SoCal visit because of Disneyland itself and the relative proximity to L.A. and San Diego. If you're staying in Carlsbad because of price, remember that you're paying less because you're further away from the SoCal hot spots. What you gain in price, you will probably lose in traffic and time. And if you're there for family, I would do Disneyland at the very beginning and stay in Anaheim for the Disneyland portion before or after Carlsbad.