Solved

Document contains no data

Posted on 1997-08-17
7
166 Views
Last Modified: 2013-12-25
I have a form which updates a number of files. when the form is empty and I press submit everthing works fine.
Howver if I try to submit the form with data I get a netscape error document contains no data.

What is going wrong?

0
Comment
Question by:slat
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 2

Expert Comment

by:n3mtr
ID: 1829718
Netscape is trying to tell you that the CGI program is returning a blank document.  Nothing in it.  It seems when the script gets data it forgets to return a response.
Without more information, thats all I can say.
Whay script are you using? Did you write it yourself?  Can you post it here?(if its short)

0
 

Author Comment

by:slat
ID: 1829719
The cgi script is a bit complicated.
The relevant part does the following things.
1) the form contains a hiden field action=Modify, when the data is parsed using cgi-lib all the data in %in si passed to a subroutine for processing.

2) there 3 files are opened , then the data is processed then the data is written to the each of the files, an d the files clesed;
Here is the relevant code:

foreach $cle(@Env_Var::Total_options) {

           $array_nom = "Env_Var::" . $cle . "_ops";
           $vide_hash = "Env_Var::" . $cle . "_vide"; # whether a field can be empty or not
           $Sur_Prog = $BIN_DIR . $cle . ".pl"; # put in option for http progs
here ie . "H" . $cle ....
             # use strict 'refs';
         HERE: {

            for ($y=1; $y <= $Env_Var::Nombres{$cle}; $y++) {

                # local($op,$nom,$min,$jr,$mois,$hr, $alerte, $warn, $fich);
                if ($Env_Var::Nombres{$cle} > 1) { $op = "$cle" . "$y"} else { $op = $cle;}
                $nom = $op . "_nom"; #every thing being nom  must have a nom
                 next HERE if (($CHECKED_data{$nom} eq "") || ($CHECKED_data{$nom} eq "non"));
                $Cron_String = $Sur_Prog . " " . $nom_machine . " " . $Env_Var::KNOWN_HOSTS{$nom_machine}; # <-prog host os; reset every loop
                foreach $el (@{$array_nom}) {

                   # each field in the form becomes $cle . $y . $el, ie $op = $cle . $y .$el, and the data is written to the files, eg print FILE $data, "=", $data{$op}, "\n"; however the program never makes it passed the above for loop; I have put a subroutine which prints out a html page just before the loop followed by a next statement so the the loop is not processed, which worked; however, when I allow this loop to be processed I get the error ¨document contains no data¨ - note: there is no error in the error_log file ; also I have even tried replacing the symbolic array reference with a simple array, but I still got the same error;
           }  
         } #HERE
       }# total ops
# files close;
# subroutine to display a html page

} end of subroutine

- I realise this isn't very clear, but the full code is very long and complicated. However, I would be extremely grateful if you if
you have any inkling as to why it never gets passed the third for loop

Thanks
                           
0
 
LVL 2

Expert Comment

by:n3mtr
ID: 1829720
have you run: perl -cw script
to check the warnings for a possible problem?
0
Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

 
LVL 5

Expert Comment

by:icd
ID: 1829721
You should also look at the error log on your server. It is likely you have a run-time error with your script which is causing it to fail. The error log is likely to tell you roughly which line of the script is failing.

0
 

Expert Comment

by:edl
ID: 1829722
All of the above advice is good.  When doing cgi, always do perl -c prog.pl.

And when a program like this is giving you problems you are probably going to have to go in debug mode.  Put a simple print statement in the beginning of your program then exit(1);

If that get's printed to the web browser, then you just have to start debugging your code.

0
 
LVL 8

Accepted Solution

by:
jhurst earned 100 total points
ID: 1829723
the message is caused by the fact that the script is presenting no data at all.  My guess is that when there is data in the form the script fails and so does not generate, or at least does not complete the output.

You need to run the same script directly at the shell and pass it the input required.  If your are using GET then you can merely set the QUERY_STRING environment variable with the data that you believe is being passed to the form.  If POST then you just input it.  In this mode you should see the output and/or error.  I would also consider re-directing the stderr so you can see if there is a reported error.
0
 

Author Comment

by:slat
ID: 1829724
thank you everyone for your assistance.

Yes the reason was that the cgi script was sending no data
back. There was an error in a subroutine, used to process the data.

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial will discuss fancy secure registration forms, with AJAX technology support. In this article I assume you already know HTML and some JS. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you mig…
This article will show, step by step, how to integrate R code into a R Sweave document
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question