Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Submit form on differant domains

Posted on 2012-04-02
11
Medium Priority
?
262 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
[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
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

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…
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
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

722 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