I am trying to come up with this interface with the backend on perl. The interface needs drop down boxes with dynamic chain loading ( as in contents of the 1st drop down box will populate the second drop down and so on) Any idea how I can do this?
Use HTML with a single form element embracing all your drop downs ("select"s). You may need some Javascript to initiate script-triggered form submit when user changes the dropdown selection. As the form submission takes place, it will be received by Web server and the form processor is presumably a CGI script which receives the form parameters, re-generate the HTML to highlight the selected option and present an updated view based on what is selected. This CGI script can be written in Perl and executed from a CGI-enabled Web server.
If you understand HTML form processing and CGI, this should be a pretty straightforward task. Otherwise, please do some reading on this (i.e. HTML forms and Perl CGI scripting), as we cannot cover so much knowledge with such a tiny space here.
I understand the HTML and CGI part of it. But how do I integrate the Javascript into this? It will help me if you can lead me to some documentation on the same. Thanks
Javascript is just embedded in HTML (or in a separate .js file linked from the HTML, as I normally prefer), so your CGI just output the "script" element like normal plain text with Perl/CGI.
Javascript is the language you write your client-side scripts, but to access the objects on the HTML document (such as form controls) you will need to do so through the Javascript binding of DOM. You will need to set Javascript event handlers to capture selection change event of dropboxes.
The following error props up when I choose something in the first list
"The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error. "
Hi. Sorry to be bugging you so much. But I am not able to understand this piece of code you showed me as an example. What must I go through to understand this? Please lead me to some pointers.
Assuming you really know HTML (can hand-code it) and you know what CGI is (please read the CGI specification otherwise although rather dated) as you previously mentioned, then you should learn Javascript and DOM, and probably Perl too if you are not too familiar with it.
It's difficult to give you any specific pointers as I do not know how much you know about all of these things. However, as you do not understand how the script works, then I really doubt whether you have production knowledge in HTML and CGI, as this is a really simple example.
You can do a directory or Google search on these keywords and you ought to find a lot of resources. You may probably wish to buy some books on these subjects but I have no recommendations at this point.
I would suggest you to ensure you have working knowledge of the client tier first, i.e. HTML and Javascript/DOM. Then you can proceed further to understand how to generate them on the server side, and investigate how CGI allows you to capture form parameters on the server-side, and send back the response.