I am afraid the storyline provided here is completely Wrong. Either the person who provided the storyline has not seen the movie or got confused with some other one. Please change the storyline as follows:
The kingdom's chief minister wants his son to marry the king's daughter, Princess Vidyadhare. When he expresses his wish to the king, he is ridiculed. Instead, the king orders him to search for a "Sakala Vidya Paarangatha" groom for his daughter. Vowing to take revenge against the insult, the minister goes in search of a foolish groom. Kalidasa, a humble shepherd, is shown rearing his sheep. Convinced of his stupidity, the minister charms Kalidasa to accompany him to the palace, so that Kalidasa can marry the princess. Coached by the minister, Kalidasa excels in the tests conducted by Vidyadhare (Jaya Pradha). The minister is shrewd enough to teach a key sentence to Kalidasa. If he can't answer a question, Kalidasa must utter "heluvudakkU, kEluvudakku, idu samayavalla" ("This isn't the right time to question or answer.") Vidyadhare is fooled by Kalidasa's brilliance and marries him. However, the truth comes out during the first night. Shattered, Vidyadhare locks Kalidasa in the palace temple and gets him to demand "vidyaabuddhi" (knowledge and wisdom) from the goddess Kali. (reference matches with Wiki)