Link to home
Start Free TrialLog in
Avatar of wapware
wapware

asked on

How to set a %Session variable% from a client posting script?

Hi, I have struck the following problem in a perl script posting data to a server.

A particular field gets drawn up with javascript and is not able to be posted to in the regular way. It is using some soft of Active X thing which I cannot use on my Linux client calling with a perl client.

Is ther a way I can set the %=Session("ConsReceiverCompany")% Variable in my Perl Client Script?

--SNIP-- PERL CLIENT--
my $request  = $ua->request( POST 'http://www.mypage.com.au/test.asp' );
my $form = HTML::Form->parse( $request->content, $request->base());
$form->value( 'ConsPayee', "S" );  
$form->value( 'ConsReceiverCompany', "My Name" );
my $response = $ua->request( $form->click('cmdSubmit') );
print $response->as_string;
--/SNIP--PERL CLIENT--

Gives an error when run of;
No such field 'ConsReceiverCompany' at book.pl line 62 error

It is however a compulsory to fill in from a standard web browser.

They sent me the ASP server page and I wonder how I can submit/post/set the ConsReceiverCompany as a variable ?

--SNIP ASP WINDOZE SERVER--
<SCRIPT LANGUAGE="JavaScript">
<!--
function handleActiveXError (err, url, line) {

      if (err.indexOf('Automation') != -1) {
            err = "";
            return true; // error is handled
            }
      else {
            alert(err);
            return false; // let the browser handle the error
            }
}
var booFMReceivers = false;

strCompanyEtc = '<tr>'
  + '<td  bgcolor="#cccccc" align="left">'
      + '<font size="2" face="Arial,Verdana" color="#000000">'
          + 'Receiver Company Name:'
      + '</font>'
  + '</td>'
  + '<td bgcolor="#0a4e91">'
      + '<font face="arial,verdana" color="#000000">'
      + '<input type="text" name="ConsReceiverCompany"  size="30" maxlength="30" value="<%=Session("ConsReceiverCompany")%>"><img src="/i/smRedArw.GIF" width="11" height="14">'
      + '</font>'
  + '</td>'
  + '</tr>';

var strSupressCert = false;
if (navigator.appName.indexOf('Microsoft') != -1) {
      var booUseActiveX = null;
      if (navigator.cookieEnabled == true) {
            booUseActiveX = getCookie("ActiveXControls"); }
      if (booUseActiveX == null)
        {
      //      if (confirm("Do you want to download an AaE control to enhance your Receiver Details handling?"))
      //        {
      //            booFMReceivers = true;
      //            booUseActiveX = "Yes";
      //            strSupressCert = true;
      //        }
      //      else
      //        {
      //            booFMReceivers = false;
      //            booUseActiveX = "No";
      //        }
            if (navigator.cookieEnabled == true)
                  setCookie("ActiveXControls",booUseActiveX,10000);
        }                  
      var strAskAgain = "";
//      if (booUseActiveX == "Yes") {
            window.defaultOnError = window.onerror; // store default handler
            window.onerror = handleActiveXError; // assign own handler            
//            window.onerror = NoErrors; // assign own handler            
// run here to allow user to refuse ActiveX Control
              if (strSupressCert)
// don't trigger the download until Receiver object is set up
                    var oReceiver = true;               
              else {
                    var oReceiver = new ActiveXObject('FMReceivers.FMReceiver');}
              
// the rest of the script doesn't get executed anyway if user said No
            window.onerror = window.defaultOnError;  // restore default handler
            if (oReceiver) {
                  booFMReceivers = true; }
            else {
                  booFMReceivers = false; }
//        }
//      else
//        {
          strAskAgain = '<tr><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;'
                  + 'Ask me again to download Receiver handling Component? &nbsp;'
                  + '<INPUT type="checkbox" id="chkActiveX" name="chkActiveX" value="checked" onClick="return AskAgain()">'
                  + '</td></tr>';}
//}


if (booFMReceivers)
{
      strVersion = "V1";
      strCompanyEtc = '<tr><td bgcolor="#cccccc" align="left" colspan="2">'
//          + '<OBJECT CLASSID="CLSID:678A494A-CF32-11D5-9BB8-0050DA8C84DD" id="FMReceiver"    codebase="FMReceivers.CAB#version=3,1,0,1"></OBJECT>'
//          + '<OBJECT CLASSID="CLSID:678A494A-CF32-11D5-9BB8-0050DA8C84DD" id="FMReceiver"   codebase="http://173.200.3.248/consignment/FMReceivers.CAB#version=3,1,0,1"></OBJECT>'
          + '<OBJECT CLASSID="CLSID:678A494A-CF32-11D5-9BB8-0050DA8C84DD" id="FMReceiver"   codebase="/consignment/FMReceivers.CAB#version=3,1,0,1"></OBJECT>'
            + '</td></tr>'
            + '<input type="hidden" name="ConsReceiverCompany"  size="30" maxlength="30" value="<%=Session("ConsReceiverCompany")%>">'
      ;
}
//-->
</SCRIPT>
--/SNIP ASP ON WINDOZE SERVER--
ASKER CERTIFIED SOLUTION
Avatar of ahoffmann
ahoffmann
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Dave Cross
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept ahoffman's comment as an answer

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
davorg
EE Cleanup Volunteer