Web page with frames...

D

Dave Brown

I'm trying to create a web page which has 2 frames, left and right.
In the left frame is a form to enter a number of data elements. In
the right frame, to start with, is some text with instructions. The
user is to enter data into the left frame and submit, in which case
calculations take place, and the results are then displayed in the
right frame. (The data is to be retained in the left frame in case
the user wants to make some changes to it, and resubmit.)

I've got the code written for the left frame. I've got code written to
do the calculations. Here's the question: when I submit the form, which
kicks off the CGI script to do the calculations, what do I do (I presume)
in the CGI script to get it to send the result to the frame on the right?

I've thought that I could probably have the CGI script create an html
page, and then put a "Display" button in the left frame to have it
"target" its output to the right frame. But I was wondering if I could
do something so that it would send it automatically without the Display
button.

Any hints to get me started in the right direction would be appreciated.
 
M

mgarrish

Dave Brown said:
I've got the code written for the left frame. I've got code written to
do the calculations. Here's the question: when I submit the form, which
kicks off the CGI script to do the calculations, what do I do (I presume)
in the CGI script to get it to send the result to the frame on the right?

You do it all in javascript. Put a "javascript: void 0" on the submit button
so that the page you don't want to change doesn't, and the then create a
function to change the other page with data from the first (i.e., get the
values from your form, create a link to your cgi script including those
values and then use top.frameiwantochange.location.href to update the page).
Sometimes its just easier to create an invisible form that mirrors the one
in the frame you want to display your results in, copy all the current
values over when the user clicks submit, and then submit that form. I'm sure
there are other ways, too, but you're going to have to do it all on the
client side.

Matt
 
M

Mark

I've got the code written for the left frame. I've got code written to
do the calculations. Here's the question: when I submit the form, which
kicks off the CGI script to do the calculations, what do I do (I presume)
in the CGI script to get it to send the result to the frame on the right?

According to the O'Reilly's HTML- the definitive guide (the Koala book), the
form tag has a target attribute. Simply add 'target=<right frame>' to the
form tag to notify the browser that form results should be displayed on the
right.

You might also consider dropping the whole framing concept and simply return
the completed form as part of the CGI output- this would increase
compatibility and eliminate issues with synchronizing frames and 'back'
button presses.

I'm not saying that separate <form> and <output> data is necessarily bad,
but IMHO managing some data on the client side and some server side is more
difficult than evaluating (and responding to) all the data as a fresh
transaction.
 
J

Jürgen Exner

Dave said:
[...] web page [...] frames[...] form [...] submit [...]
right frame [...] left frame [...] CGI [...] html [...]
page [...] button [...]

None of that has anything to do with Perl whatsoever.
Do you have any Perl-related question, too?

jue
 
D

Dave Brown

According to the O'Reilly's HTML- the definitive guide (the Koala book), the
form tag has a target attribute. Simply add 'target=<right frame>' to the
form tag to notify the browser that form results should be displayed on the
right.

You might also consider dropping the whole framing concept and simply return
the completed form as part of the CGI output- this would increase
compatibility and eliminate issues with synchronizing frames and 'back'
button presses.

I'm not saying that separate <form> and <output> data is necessarily bad,
but IMHO managing some data on the client side and some server side is more
difficult than evaluating (and responding to) all the data as a fresh
transaction.

I tried the "target" tag, and it worked. As I posted in other followup,
the data is lost. So I've been coming to the same conclusion as you
recommend... regenerate the form as part of the CGI output.

Or I'm thinking of storing the data in a cookie... (As you can tell, I'm a
novice at CGI programming.)
 
E

Eric Schwartz

Dave Brown said:
Caught by the topic police. (It has to do with CGI programming
which I happen to be doing in perl.)

Yes, people do a lot of things with Perl; that doesn't make questions
about them Perl questions. I'm writing a library-cataloguing system
in Perl right now; does that make comp.lang.perl.misc a good place to
ask if I should use Library of Congress or Dewey-Decimal indexing?
(In the short term, probably LoC, only because I can easily query
their database using Net::Z3950, but I'd like to offer both.)
Perhaps you could recommend
a relevant newsgroup for CGI programming?
comp.infosystems.www.authoring.cgi

BTW, the target tag worked, though I couldn't find it in my old
O'Reilly HTML book.

That's why you should always look at authoritative sources before
posting to newsgroups. Books are useful for quick references, but are
too often incomplete or out-of-date. Perl has online documentation
available by 'perldoc'; the W3C has online HTML references available.
But whereas the data entered remains in the left frame, the form
doesn't "save" it. So I can't simply change one value and "submit".
Do I need to use a cookie?

I'm sorry, I have no idea what you're trying to say here. You'd best
ask again on ciwac; they may have a better chance at interpreting your
meaning.

-=Eric
 
A

Alan J. Flavell

Caught by the topic police.

If you, like me, need lots of fresh coffee for programming, it would
be natural to ask one's Perl questions on rec.food.drink.coffee,
right?
(It has to do with CGI programming which I happen to be doing in
perl.)

Did you get the point yet?
Perhaps you could recommend a relevant newsgroup for CGI
programming?

If it's a question _about_ CGI programming, then naturally, just as it
says in perlfaq9 - comp.infosystems.www.authoring.cgi, (read its
posting instructions first - beware of the autobot...)

But if it's a problem with the HTML that you're trying to generate
from your CGI process, then they're likely to send you off for a basic
course in HTML before they'd be happy to let you loose on server-side
scripting.
BTW, the target tag worked, though I couldn't find it in my old
O'Reilly HTML book.

You really need to find the authoritative specifications for the
various technologies involved in what you're doing. No point in
writing a program to do some task until you've understood basically
what that task is (to be frank.)

good luck
 
M

mgarrish

Eric Schwartz said:
Yes, people do a lot of things with Perl; that doesn't make questions
about them Perl questions. I'm writing a library-cataloguing system
in Perl right now; does that make comp.lang.perl.misc a good place to
ask if I should use Library of Congress or Dewey-Decimal indexing?
(In the short term, probably LoC, only because I can easily query
their database using Net::Z3950, but I'd like to offer both.)

And a lot of people offer that same incredibly trite answer, which is
equally pointless. For one, the offenders obviously don't know where they
should be posting, so being a prick does nothing but make yourself look like
a moron. Second, it's not going to change anything; the people who post
off-topic questions are usually the ones who have never looked for the
answer. And finally, it does nothing to help the poster find his way to
where he should be posting. (And I'm referring more to the resident jackass
in this group who posted the earlier reply.) If you don't like off-topic
posts, stick to a moderated group...

Matt
(who eagerly awaits the day someone creates a way to send an e-slap)
 
T

Tintin

mgarrish said:
And a lot of people offer that same incredibly trite answer, which is
equally pointless. For one, the offenders obviously don't know where they
should be posting, so being a prick does nothing but make yourself look like
a moron. Second, it's not going to change anything; the people who post
off-topic questions are usually the ones who have never looked for the
answer. And finally, it does nothing to help the poster find his way to
where he should be posting. (And I'm referring more to the resident jackass
in this group who posted the earlier reply.) If you don't like off-topic
posts, stick to a moderated group...

Matt
(who eagerly awaits the day someone creates a way to send an e-slap)

The one thing you are forgetting are all the Usenet archives like Google
Groups. Having the so called "trite answers" at least helps some newbies in
the future how have the common decency to search before they post.
 
M

mgarrish

Tintin said:
The one thing you are forgetting are all the Usenet archives like Google
Groups. Having the so called "trite answers" at least helps some newbies in
the future how have the common decency to search before they post.

I'd like to hear your explanation of what good Jurgen's answer does anyone
(newbie or not). Someone posting an off-topic question isn't an invitation
to show what a jerk you can be. Either don't answer at all, or show a little
civility and point the person in the right direction. It shows more
character to help someone than to write a post that just strokes your own
ego.

Matt
 
E

Eric Schwartz

mgarrish said:
I'd like to hear your explanation of what good Jurgen's answer does anyone
(newbie or not).

It tells them their question is not a Perl question. It also tells
them that non-Perl-related questions aren't welcome here.
Someone posting an off-topic question isn't an invitation
to show what a jerk you can be. Either don't answer at all, or show
a little civility and point the person in the right direction. It
shows more character to help someone than to write a post that just
strokes your own ego.

Go for it. Nobody's stopping you.

-=Eric
 
M

mgarrish

Eric Schwartz said:
It tells them their question is not a Perl question. It also tells
them that non-Perl-related questions aren't welcome here.

It's a pathetic attempt to garner attention for one's self. It neither
addresses the problem (that the user didn't know where to post), nor does it
do anything but provoke the poster into a flame war. He wasn't asking anyone
to do his work for him. He wasn't rude, either. He just "thought" he was
asking a Perl question. Hardly justification for such a stupid response.

Matt
 
E

Eric Schwartz

mgarrish said:
It's a pathetic attempt to garner attention for one's self.

You're wrong.
Hardly justification for such a stupid response.

Tell ya what. You stick around here for oh, 5 years or so, answering
the same exact set of questions several times a day, politely and
cheerfully, for free, and then maybe you'll be qualified to tell us
why we act the way we do.

Or you could just pop on, insult a number of people who have been
writing Perl years before you ever heard of it, and feel morally
superior.

Ya know, whatever makes you happy, really.

-=Eric
 
M

mgarrish

Eric Schwartz said:
Or you could just pop on, insult a number of people who have been
writing Perl years before you ever heard of it, and feel morally
superior.

Ooh, I feel insulted...

Nope, it just a little indigestion. Must be all the tripe.

Matt
 
M

mgarrish

Michael Budash said:
nope, must be the tripe all over your face, you ingrate. there goes your
last chance of EVER getting any useful advice from this group.

*plonk*

God bless newbies...

Matt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top