Olaf has asked for the wisdom of the Perl Monks concerning the following question:

I have an html form created.
I have perl that works from a command line.
Now, I'd like to combine the two for a nice UI with perl in the background.
What are best practices/advice for the below?

1-The first drop down list in the form is populated from a perl dbi call.
2-The user selects from the drop down list which makes another dbi call.
3-The results of this second call are used to poplulate a second drop down list.
4-The user selects from the second drop down list which makes a third dbi call.
5-The results of this third call are used to populate text fields.
6-The user can make changes to the text fields and click a button which makes changes to the database.

Any suggestions on getting started on this (show me how, or point me to a good reference) are appreciated.

Do you believe in miracles? Yes!
  • Comment on CGI: Form contents dependent on drop down lists

Replies are listed 'Best First'.
Re: CGI: Form contents dependent on drop down lists
by pileofrogs (Priest) on Dec 26, 2007 at 16:59 UTC

    This is just one thing to think about...

    Your UI involves multiple interactions. By that I mean the script has to do some processing in order to provide each step . E.G. In order to populate the 2nd drop-down, the script has to process the results of the 1st drop-down. Etc...

    Since you're describing multiple interactions, you're going to have to either reload the page multiple times or do some ajax magic. Or you could have one page per list.

    So, the slickness of your UI depends on how complex you're willing to make your code. If you want to keep it simple, you might want to make it multiple pages. (Those multiple pages could still be generated by a single script though..)

      Reloading the page several times was the direction I was headed. Is this then best accomplished with some
       if(param(...
      statements to check if drop down list values have been submitted?
      Thanks
      Do you believe in miracles? Yes!
Re: CGI: Form contents dependent on drop down lists
by ww (Archbishop) on Dec 26, 2007 at 17:06 UTC
Re: CGI: Form contents dependent on drop down lists
by narainhere (Monk) on Dec 26, 2007 at 17:44 UTC
    If you Drop-Down boxes contain something like country->state->city which is a classic scenario, then I would suggest you make a single call to DB then write the results to a Java Script and do everthing on the client-side instead of hitting-back the server.But don't follow this approach if the data-volume is high!

    The world is so big for any individual to conquer