Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Dynamic web pages (interactive table)

by gnu@perl (Pilgrim)
on Oct 17, 2002 at 14:54 UTC ( [id://206042]=perlquestion: print w/replies, xml ) Need Help??

gnu@perl has asked for the wisdom of the Perl Monks concerning the following question:

I have a web server that creates dynamic web pages, even the main page is dynamic. Each page is created on the fly using perl.

All works fine, but what I would like to do is (this is a little off topic) create an interactive table. Much like using frames where you would have a frame on the left with menu items that would update the frame on the right with the requested document.

The information in the cells is going to be kept in a HoH or AoA or whatever fits my fancy at the moment.

I wish to do this with tables instead of frames. Where clicking on a link in one cell updates the contents of another cell. I am fairly new to HTML and don't know a lot. I can make pages, links etc, but no advanced stuff. I don't know any HTML scripting langs, but am not against learning them, just haven't gotten around to doing it.

Is this something that can be done or do I have to use frames?

TIA, Chad.

edited: Thu Oct 17 16:56:34 2002 by jeffa - title addition

Replies are listed 'Best First'.
Re: Dynamic web pages (interactive table)
by dwatson06 (Friar) on Oct 17, 2002 at 15:04 UTC
    If you want to do it on the client side and save your server some wear and tear, you can use JavaScript (InnerHTML). The down side of this is, there will be some minor code changes between browsers, plus you will need to learn the basics of JavaScript.

    If you want to do it server side, you can make a hyperlink to pass a variable back to the page and have the server spit out the table layout based on what parameter was passed in.

    Hope this helps,
    Daniel
Re: Dynamic web pages (interactive table)
by newrisedesigns (Curate) on Oct 17, 2002 at 17:17 UTC

    What constitutes a framed web page are a frameset (an HTML page that outlines the location and layout of the frames) and the content that is filled in each frame. This layout allows you to load a new page (dynamic or static) and leave the other frames as-is.

    I'm not advocating frames, but they may be better suited to your task because (without using messy-icky javascript) your table can't be displayed and then modified without another request to the server.

    If this method is okay for your purposes, might I suggest the following: assume you want a series of links on the left-hand-most side that will load something new in the right-hand side of the table.

    Item 1 Click a Link to the Left to View More
    Item 2
    Item 3
    Item 4
    Item 5
    View source to see how this is done, in case you're unsure of the HTML

    Make each of the items a GET query to your perl program, and have it write back out the same table, but with the new content in the right side.

    If you have any other questions, please feel free to ask!

    John J Reiser
    newrisedesigns.com

Re: Dynamic web pages (interactive table)
by barrd (Canon) on Oct 17, 2002 at 17:22 UTC
    As dwatson06 mentioned the only way without a page reload achieved with a hyper-link or form submit is the dreaded JavaScript (Nee LiveScript). The reason I say 'dreaded' is that many Monks will tell you its inherently unsafe (esp. for reading Cookies etc) its also notoriously unstable between different UAs (Browsers). Many folks turn it off as a default, so you will have to take that into consideration as well.

    If you haven't been put off yet here's a link (offsite) to a good resource for JavaScript: javascript.internet.com. However I would seriously consider the server side model as I have already stated - too many things can|will go wrong with the client side approach.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://206042]
Approved by defyance
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2024-04-23 09:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found