There is no law that forbids driving while dilated. Anyway, spanish traffic laws indicate that you should avoid driving while under the effects of eye dilation.
Dilation of the eye prevents the pupil from closing to light. By day, the person is most likely to be permanently uncomfortable by sunlight; while at night, the intense brightness of car headlights can make you dazzle.
Driving ability is decreased by eye dilation, thus the risk of suffering an accident is higher. We recommend to avoid driving and go accompanied to the ophthalmologist appointment.
If you are interested in knowing more, you can check this article.