Solved

Submit form on differant domains

Posted on 2012-04-02
11
255 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
 
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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
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 500 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

746 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now