Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Hierarchical HTML frame processing (somewhat OT)

by mikeB (Friar)
on Nov 08, 2001 at 02:29 UTC ( #123940=perlquestion: print w/replies, xml ) Need Help??

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

I'm having trouble figuring out how to do a "hierarchical frameset" in a perl CGI. The desired result is a set of frames with a parent/child relationship, e.g. department, team, and member. Each of these frames has a form which, when updated, causes that frame and "lower" ones to be updated.

I currently have a non-frame implementation, as well as the beginnings of a frame implementation. The problem is that, while I can get a form submit to update it's source frame, or a single target frame, I can't find a way to update multiple frames. I.e, submitting the department form should cause updates for all three; submitting the team form would cause updates in the team and member frames; and the member form would update only the member frame.

FWIW, the frame version of the CGI currently has a dispatch table with actions for each frame and form.

It seems a nested/recursive solution is called for, but the implementation eludes me. Any pointers or hints ??

  • Comment on Hierarchical HTML frame processing (somewhat OT)

Replies are listed 'Best First'.
Re: Hierarchical HTML frame processing (somewhat OT)
by higle (Chaplain) on Nov 08, 2001 at 02:37 UTC
    This is something that you could probably do much more easily using JavaScript.

    It'd be nice to use Perl for everything, but every now and again you have to stray...

    <SCRIPT TYPE="text/javascript"> function doSubmit() { parent.framename.document.location.replace(''); parent.framename2.document.location.replace(''); } </SCRIPT> .... <FORM onSubmit="doSubmit()"> ....

    perl -e 's=$;$/=$\;W=i;$\=$/;s;;XYW\\U$"\;\);sig,$_^=$[x5,print;'
      I agree with what higle said. This is very similar to what I use and it works quite well.
(crazyinsomniac) Re: Hierarchical HTML frame processing (somewhat OT)
by crazyinsomniac (Prior) on Nov 08, 2001 at 13:32 UTC
    I really hated that javascript answer above (bs answer imho).

    This is more of an html question than a CGI one

    While I have no clue what your frame structure looks like, here's some advice:

    // frame1 = frame2 = frame3 =
    there's a form on frame1, and you want it to update frame1 frame2 and frame3 when it's submitted

    the solution, specify target=_top

    If you wish to update only 2 of the 3 available frames, the answer is the same, specify target=_top and update the entire frameset (if it's all in one frameset).

    If you have 2 framesets, frameset1 which has frame1, and frameset2, which has frame2 and frame3, and you wish to update only frames 2 and 3, then just update frameset2, and frame1 can remain without changing.

    I also sugguest you specify an expiration date for each of the pages, so people can take advantage of caching (this prolly means a the same get string)

    If you have no idea what i'm talking about, form target

    Now for the perl part

    #!/usr/bin/perl -wT use CGI qw/ :all /; my $fs = param("fs") || 0; # frameset my $fr = param("fr") || 0; # frame ## only numbers are acceptable $fs =~ s/\D//g; $fr =~ s/\D//g; $fs ||= 0; # if they weren't defined, or were gibberish $fr ||= 0; # they best be 0 $|=1; # unbuffer print header(-type => 'text/html', # cache only for five minutes -expires => '+5m' ), # you clients that cache if($fs == 1) { &generate_frameset1(); } elsif($fs ==2) { if($fr == 2) { &generate_frame2(); } elsif($fr == 3) { &generate_frame3() } else { &generate_frameset1(); } } else { &generate_frameset_all(); } ### ... the actual subroutines below ### writes something like <frameset 1> <frame src =";fr=1;"> <frameset 2> <frame src =";fr=3;"> <frame src =";fr=3;"> </frameset> </frameset>
    I think this is plenty to get you started, lemme if it helps out (and what you settle on).

    Do remember, javascript is a client-side. paranoia, paranoia, paranoia...

    Disclaimer: Don't blame. It came from inside the void

    perl -e "$q=$_;map({chr unpack qq;H*;,$_}split(q;;,q*H*));print;$q/$q;"

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (1)
As of 2022-01-17 05:21 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (51 votes). Check out past polls.