The problem to learn to surf on a shortboard is that it is the Formula one of surfing. It's super fast, really unstable and hyper reactive.
You can't learn the basics of surfing on something as slippery as a bar of soap. Why? Because things are happening so fast on it that you can't understand what's happening. As a beginner, you will spend most of your time falling as soon as you're standing up on the shorboard. It will give you poor feedback to understand how to progress and you won't have that much fun.
Whereas on a longboard, you have time to understand what's going on when you're standing up on the deck. You can rectify your feet placement when you feel unbalanced.
Longboards are forgiving board, because they're more stable and slower. You will spend more time standing up on it as a beginner than surfing a shortboard. Then you will have feedback to progress and you will have much more fun. A longboard is the best board to learn how to surf: It's very stable, very forgiving.
Later, when you master the longboard and the basics of surfing: pop-up, bottom-turns, top-turns and so on, you will be able to try shorter boards. Because you will have built strong foundations, reflexes and balance. Because you will instinctively know how to surf on a less balanced, less forgiving and faster board.
It's like bicycling: You don't learn it on a racing bike but on a tricycle: it's slower, more stable and forgiving.
Once you master the basics of surfing, you don't necessarily have to ditch your first board for a shorter one. Some very good surfers still have a lot of fun with long foam boards dedicated to beginners. Take a look at Jamie O'Brien for example: