Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Submit form on differant domains

Posted on 2012-04-02
11
Medium Priority
?
264 Views
Last Modified: 2012-04-17
Hi

I'm creating  a geoserver apllication and need to submit my form accross domains

the form is in

localhost/cgi-bin/myform.pl

the recivinng script is at

localhost:8080/cgi-bin/Getform.pl

on submit a blank window opens and then the save to dialog box appears.

How can i get round this?


sample form
<form action="http:://localhost:8080/cgi-bin/Getform.pl" method=post target="_blank">

<input type ="text" name="myVar1">
<input type ="text" name="myVar2">
<input type ="submit"  value="Submit">
</form>

Open in new window


Getform.pl
#!/usr/local/bin/perl
print "Content-type:text/html\n\n";

use CGI;
 my $q = CGI->new;
my $HiddenText = $q->param('HiddenText');

my @Names = $q->param;

print <<HTML;
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=windows-1250">
  <meta name="generator" content="PSPad editor, www.pspad.com">
  <title>MyForm</title>
  </head>
  <body>
  <h1>Form Values</h1>
HTML

foreach my $name (@Names)
  {
    print "<p>" . $name . "[ " . $q->param($name) . "]</p>";  
    
  }
print <<HTML;

  </body>
</html>


HTML

Open in new window

0
Comment
Question by:trevor1940
  • 5
  • 3
  • 3
11 Comments
 
LVL 7

Expert Comment

by:whosbetterthanme
ID: 37798111
Is the webserver that's serving the Getform.pl script configured to run .pl files as scripts? Is it IIS, Apache??
0
 
LVL 1

Author Comment

by:trevor1940
ID: 37798419
Webserver / GeoServer (localhost:8080) is Tomcat a cgi folder has been configured & tested to run .pl scripts On my test box, fedora,  I could possibly move all files from the Apache (localhost) server into the tomcat sever (localhost:8080) how ever this may not be possible when the application goes live
0
 
LVL 7

Expert Comment

by:whosbetterthanme
ID: 37798691
Does this script work if it's in the same directory where the other script is?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 1

Author Comment

by:trevor1940
ID: 37799495
Placing the script in localhost/cgi-bin/Getform.pl works in it takes the variables from the form & prints them but it needs to sit here localhost:8080/cgi-bin/Getform.pl because Geoserver uses AJAX to deal  with user interactions
0
 
LVL 28

Expert Comment

by:FishMonger
ID: 37801149
Does the script execute if you call it directly as opposed to via the form submission?

What are the permission settings on the script?
0
 
LVL 1

Author Comment

by:trevor1940
ID: 37802284
Yes it executes permission are 755
0
 
LVL 28

Expert Comment

by:FishMonger
ID: 37802548
Is Apache and Tomcat using the exact same system path to the cgi-bin directory?

I have almost zero experience with Tomcat, but one thing to check is that the context has "privileged="true" configured, which is needed to execute the scripts.  However, that may not be the problem in your case, since it is executing when called directly but not when called via a form submission.

Have you tried restarting Tomcat to see if that clears up the issue?
0
 
LVL 7

Expert Comment

by:whosbetterthanme
ID: 37804182
You said a "blank (window) page" opens. But is there any HTML code returned at all by viewing the source?

Did you try writing a simple script and calling directly?

#!/usr/local/bin/perl
use CGI ':standard';
print header();

print "Hello World!";
0
 
LVL 1

Author Comment

by:trevor1940
ID: 37804905
Hi

i've solved this it turns out Tomcat is pointing to the defult instalation of perl that comes with fedora I'm using a newer version of perl.

sys manager is looking into how to reconfiger tomcat so it is pointing to the newer version of perl

it's unclear why this failed accross domains but instaling the DBD modual into the defult perl location cured it.

In answer to your question i created a simple script ran it in a terminal which worked & ran in a browser that failed The script was taken from here http://www.microhowto.info/howto/connect_to_a_postgresql_database_using_perl_dbi.html 

I delibratly used a incorrect role name an error was raised in the terminal window in the browser nothing it wasn't until we looked in the logs we discovered the error
0
 
LVL 28

Accepted Solution

by:
FishMonger earned 1500 total points
ID: 37805979
I'm glad to hear that you've solved the problem, but if simply installing the DBD module solved the problem, then you left out some very important details which would have helped us to help you solve the problem and you mislead us on what was happening.
0
 
LVL 1

Author Closing Comment

by:trevor1940
ID: 37855139
I'm aware i didn't mention DBD in origenal post Sorry
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

877 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