• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 308
  • Last Modified:

One form, two different processes possible?

A customer has a form that processes through a special script created by a third party that allows the user in to search a database. The customer wants the same field entries in the form to also be sent simultaneously through another process on a different web site that captures the entries into a database using their script.

The question is, can a form be sent successfully through two different processes? Another way to put it is, can the form content be sent to more than one place? I am not referring to just a simple email form reply, but two separate processing scripts at two different remote locations.
0
weknowjack
Asked:
weknowjack
  • 8
  • 7
  • 2
  • +1
1 Solution
 
ThinkPaperCommented:
i havent done this before.. but I think that although you may not be able to "simultaneously" submit to both at once, but you should be able to "simulate" the process so it's close enough.

form submits, goes to page 1 where it does it's thing and also contains a call to open a new window that sends the info to page 2 (where page2 is outside website).
i.e.  window.open("http://boo.com/myform.asp?id=2&info=hah");
The only catch here is that it will generate 2 pages on submit.. so user will see 2 pages.

Otherwise.. the option is to submit the form to page1, which does it's thing and then does another submit to page2 which is the outside page. The catch with this one is the user will see the outside page as the end result page.
0
 
Michel PlungjanIT ExpertCommented:
In PHP you can use cUrl:
http://nl2.php.net/curl
0
 
weknowjackAuthor Commented:
mplungjan: are you saying ThinkPaper's second solution would be accomplished by yours?

The site is currently hosted on a Unix/Linux/Apache server with php 4.4.4 or 5.5.2 options. Is the cURL function's libcurl package a server side addition that must be installed by the hosting company?
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.

 
Michel PlungjanIT ExpertCommented:
I have no idea about availability of cUrl on your isp
I know you can request php1 which then requests the other form and returns both results in one page
0
 
weknowjackAuthor Commented:
I'll have to have someone else explore this option. Thanks.
0
 
ZvonkoSystems architectCommented:
You can do it on client side by adding an iframe tag and a submit global var.
Like this:

<html>
<head>
<title>Zvonko &#42;</title>
<script>
var subMitted=false;
function reDirect(){
  if(subMitted){
alert("First sub finished"); // remove this demo line
    theForm = document.forms[0];
    theForm.target="";
    theForm.action="http://url2.forSecond.sub"
    theForm.submit();
  }
}
</script>
</head>
<body>
<iframe name="sub1" onLoad="reDirect()" height="400" width="400" frameborder=1></iframe>
<form target="sub1" action="http://www.google.com/search" onSubmit="subMitted=true;">
<input type="text" name="q" >
<input type="submit" >
</form>
</body>
</html>


If you set the height and width of iframe to zero, then you will not see it.

0
 
weknowjackAuthor Commented:
By client side, you mean in the html page?
0
 
ZvonkoSystems architectCommented:
Yeap.
0
 
weknowjackAuthor Commented:
Thanks, I'll pass this on to my developer. They have tried another solution that did not work.
They were going to switch the order of the submissions to see if that would do it. I assume that such a switch might be needed with your solutions as well?
0
 
ZvonkoSystems architectCommented:
That submit that needs to be shown on submitting page as result page needs to be the SECOND submit assigned by script function reDirect().
The first submit is then only the logging submit for capture.

0
 
weknowjackAuthor Commented:
Hmmm. I'd better post for you some more info on this, because I'm not sure I am communicating this clearly. I'll have to do that later. Thank you.
0
 
ZvonkoSystems architectCommented:
Take your time.
0
 
weknowjackAuthor Commented:
Url of orginating site: http://freemovetexas.com
It's the form on the left column. If you look at the code, you see an include called recontent.exe, which processes the submission and redirect the visitor to a new page allowing access to the database. you can try it if you like. Just make up something and put test in the comment box.

The recontent.exe is located in the cgi-bin folder

The fields of the first form must also go to topproducer.com using the following .asp script provided by them. There is also a .cpp version:


<!-- Created by TOP PRODUCER -->
<!--
      You can use the following source code in your web-pages.  Please note that
      modifying the code in any way would result in TOP PRODUCER not supporting it if it does
      not work properly.
-->

<!--
      The following merge codes are for internal use of the source code generator.  For
      simplicity's sake AGENT merge codes refer to the company information in Lead Desk
      and any tags beginning with <! should be ignored.
      
       ----= APPLICATION INFORMATION =----
       AGENT1 NAME: Free Move Texas
       AGENT1 PHONE: 972-503-3733
       AGENT1 EMAIL: bobbie@freemovetexas.com
       AGENT1 PICTURE:
       AGENT2 NAME: <!AGENT2_NAME>
       AGENT2 FIRST NAME: <!AGENT2_FIRST_NAME>
       AGENT2 PHONE: <!AGENT2_PHONE>
       AGENT2 EMAIL: <!AGENT2_EMAIL>
       AGENT2 PICTURE: <!AGENT2_PICTURE>
       AGENT1 LOGO:
       SUBMIT URL: https://www.topproduceronline.com/LeadToolkit.asp
       FONT COLOR: #000000
       FONT SIZE: xx-small
       FONT STYLE: sans-serif
       BACKGROUND COLOR: #FFFFFF
       BORDER COLOR: #FFFFFF
       HEADER ALIGNMENT: Left
       HEADER FONT SIZE: xx-small
       BACKGROUND IMAGE: No
       ----= APPLICATION INFORMATION =----
//-->



<%@LANGUAGE="JScript" %>

<%

      // Write a user entered value into the HTML page safely.

      function writeSafeValue( sName ) {

            var sValue;

            sValue = "" + Request.QueryString( sName ) + "";

            try {

                  if( typeof( sValue ) == "string" ) {

                        if( sValue != "undefined" ) {

                              // Do net let the user attempt to input HTML Code or

                              // SSI (Server Side Include) directives.

                              sValue = sValue.replace( /</g, "&lt;" );

                              sValue = sValue.replace( />/g, "&gt;" );

                              sValue = sValue.replace( /\"/g, "&quot;" );

                        }

                        else {

                              sValue = "";

                        }

                  }

            } catch( e ) {

                  // Catch and display any errors that occur.

                  Response.Write( "writeValue( &quot;" + sName + "&quot; ) ERROR " + e.number + ": " + e.description + " - sValue: " + sValue );

                  sValue = "";

            }





            Response.Write( sValue );

      }

%>



<HTML>
<HEAD>
      <TITLE>Contact Me</TITLE>
      <SCRIPT LANGUAGE="JavaScript">
<!--
            // Ensure the user of this form has entered the required fields.
            function validateData()
            {
                  var txtFirstName            = getElementById( "FIRST_NAME"                  );
                  var txtLastName                  = getElementById( "LAST_NAME"                  );
                  var txtEmail                  = getElementById( "EMAIL"                        );
                  var txtPhoneAreaCode      = getElementById( "PHONE_AREA_CODE"      );
                  var txtPhoneLocalCode      = getElementById( "PHONE_LOCAL_CODE"      );
                  var txtPhoneNumber            = getElementById( "PHONE_NUMBER"            );
                  var txtComments                  = getElementById( "COMMENTS"                  );
                  var sPhoneValue                  = txtPhoneAreaCode.value + txtPhoneLocalCode.value + txtPhoneNumber.value;
                  var bRequirementsMet      = true;
                  var txtFocusField;
                  
                  if( txtFirstName.value.length == 0 && txtLastName.value.length == 0 ) {
                        txtFocusField = txtFirstName;
                        bRequirementsMet = false;
                  }
                  if( bRequirementsMet && ( txtEmail.value.length == 0 && sPhoneValue.length == 0 ) ) {
                        txtFocusField = txtEmail;
                        bRequirementsMet = false;
                  }
                  
                  if( !bRequirementsMet ) {
                        window.alert( "\nPlease enter your FIRST NAME or LAST NAME\nand\nPHONE NUMBER or EMAIL ADDRESS.\n" );
                        txtFocusField.focus();
                  } else {
                        if( sPhoneValue.length > 0 && ( txtPhoneAreaCode.value.length != 3 || txtPhoneLocalCode.value.length != 3 || txtPhoneNumber.value.length != 4 ) ) {
                              bRequirementsMet = false;
                              window.alert( "\nYou have entered an invalid phone number. Please enter a correct phone number.\n" );
                              txtPhoneAreaCode.focus();
                        }
                        if( bRequirementsMet && txtEmail.value.length > 0 ) {
                              var nAtSymbolIndex = txtEmail.value.indexOf( "@" );
                              var sUserName      = "";
                              var sServerName    = "";
                              
                              if( nAtSymbolIndex > 0 && nAtSymbolIndex < txtEmail.value.length - 1 ) {
                                    sUserName = txtEmail.value.substring( 0, nAtSymbolIndex );
                                    sServerName = txtEmail.value.substring( nAtSymbolIndex + 1 );
                                    nAtSymbolIndex = sServerName.indexOf( "." );
                              }
                              if( nAtSymbolIndex == -1 || sUserName.length == 0 || sServerName.length == 0 ) {
                                    window.alert( "You have entered an invalid email address. Please enter a correct email address." );
                                    txtEmail.focus();
                                    bRequirementsMet = false;
                              }
                        }
                        if( bRequirementsMet && txtComments.value.length > 2900 ) {
                              bRequirementsMet = false;
                              window.alert( "\nYour comments are too long.  Please try to limit the length of your comments to 2900 characters.\n" );
                              txtComments.focus();
                        }
                  }
                  
                  return bRequirementsMet;
            }
            

            // Retrieve an element by it's ID attribute
            // NOTE: This function is used in place of
            //  'document.getElementById() to support
            //  Internet Explorer 4.01.
            function getElementById( id ) {
                  if( typeof( document.getElementById ) == "undefined" ) {
                        for( var i = 0; i < document.all.length; i++ ) {
                              var el = document.all( i );
                              if( el.id == id ) {
                                    return el;
                              }
                        }
                  }
                  else {
                        return document.getElementById( id );
                  }
            }
            
            
            function moveToNextField( id ) {
                  if( window.event.keyCode != 9 ) {
                        if( getElementById( id ).value.length == 3 ) {
                              if( id == "PHONE_AREA_CODE" ) {
                                    getElementById( "PHONE_LOCAL_CODE" ).focus();
                              }
                              else if( id == "PHONE_LOCAL_CODE" ) {
                                    getElementById( "PHONE_NUMBER" ).focus();
                              }
                        }
                  }
            }
            
            
            function init() {
                  size( getElementById( "TABLE_PICTURES" ) );
                  var backgroundImage = getElementById( "BACKGROUND_IMAGE" );
                  if( typeof( backgroundImage ) != "undefined" && backgroundImage != null ) {
                        backgroundImage.style.visibility = "visible";
                  }
                  
                  window.moveTo( 0, 0 );
                  window.resizeTo( screen.availWidth, screen.availHeight );
                  
                  getElementById( "FIRST_NAME" ).onkeypress = Capitalize;
                  getElementById( "LAST_NAME" ).onkeypress = Capitalize;
            }
            
            
            function size( objTable ) {
                  var backgroundImage = getElementById( "BACKGROUND_IMAGE" );
                  
                  if( typeof( backgroundImage ) != "undefined" && typeof( objTable ) != "undefined" && backgroundImage != null ) {
                        backgroundImage.style.left   = objTable.offsetLeft;
                        backgroundImage.style.top    = objTable.offsetTop;
                        backgroundImage.style.width  = objTable.offsetWidth;
                        backgroundImage.style.height = objTable.offsetHeight;
                  }
            }

            
            function allowKeys( obj, keys ) {
                  var bAllowKey = false;
                  for( var i = 0; i < keys.length; i++ ) {
                        if( keys.charAt( i ) == String.fromCharCode( window.event.keyCode ) ) {
                              bAllowKey = true;
                              break;
                        }
                  }
                  if( !bAllowKey ) {
                        window.event.cancelBubble = true;
                        window.event.keyCode = 0;
                  }
            }
            
            
            function validateInput( obj, keys ) {
                  if( typeof( window.clipboardData ) != "undefined" ) {
                        var sData = window.clipboardData.getData( "Text" )
                        var sTemp = "";
                        if( typeof( sData ) != "undefined" ) {
                              for( var i = sData.length; --i >= 0; ) {
                                    for( var j = keys.length; --j >= 0; ) {
                                          if( sData.charAt( i ) == keys.charAt( j ) ) {
                                                sTemp += sData.charAt( i );
                                          }
                                    }
                              }
                        }
                  
                        window.clipboardData.setData( "Text", sTemp );
                  }
            }
            
            function enableSection( section ) {
            }
            

            function enableBestTime() {
                  var txtPhoneArea      = getElementById( "PHONE_AREA_CODE"            );
                  var txtPhoneLocal      = getElementById( "PHONE_LOCAL_CODE"      );
                  var txtPhoneNumber      = getElementById( "PHONE_NUMBER"            );
                  var obgBestTime            = getElementById( "BEST_TIME"                  );
                  
                  if( typeof( txtPhoneArea ) != "undefined" && txtPhoneArea != null && typeof( obgBestTime ) != "undefined" && obgBestTime != null ) {
                        obgBestTime.disabled = !( txtPhoneArea.value.length != 0 || txtPhoneLocal.value.length != 0 || txtPhoneNumber.value.length != 0 );
                  }
            }
            
            function Capitalize()
            {
                  var el = window.event.srcElement;
                  if( el == null ) return;
                  
                  if( el.getAttribute( "CAP" ) == null )
                  {
                        el.setAttribute( "CAP", "1" );
                        if( el.value == "" ) {
                              var nUCharCode = String.fromCharCode( window.event.keyCode ).toUpperCase().charCodeAt(0);
                              window.event.keyCode = nUCharCode;
                        }
                  }
            }
            
            
            function Submit()
            {
                  if( validateData() ) {
                        getElementById( "SUBMIT" ).disabled = true;
                        var pForm = getElementById( "frmMain" );
                        pForm.submit();
                  }
            }
//-->
      </SCRIPT>

</HEAD>
<BODY BGCOLOR="#FFFFFF" STYLE="font-size: xx-small; font-family: sans-serif; COLOR: #000000; BORDER: 0.25in SOLID WHITE" onLoad="init();" onResize="size( getElementById( 'TABLE_PICTURES' ) );">
      <!-- Preview text goes here -->
      <CENTER>
            <!-- Agent Picture and Company Logo //-->
            
            <TABLE ID="TABLE_PICTURES" WIDTH=100% STYLE="font-size: xx-small; font-family: sans-serif; COLOR: #000000;">
                                    <TR WIDTH=100%>
                        <TD><!AGENT1_PIC_HTML></TD>
                        <TD ALIGN=LEFT VALIGN=TOP WIDTH=90%>
                              <STRONG>Free Move Texas</STRONG><BR><BR>
                              Phone:&nbsp;972-503-3733<BR>
                              Email:&nbsp;<A HREF="mailto:bobbie@freemovetexas.com">bobbie@freemovetexas.com</A>
                        </TD>
                        <TD ALIGN=RIGHT VALIGN=TOP ROWSPAN=2><!COMPANY_PIC_HTML></TD>
                  </TR>

            </TABLE>
            <HR>
            <FORM ID="frmMain" ACTION="https://www.topproduceronline.com/LeadToolkit.asp" METHOD=post>
                  <DIV ID="CONTACT_INFO" NAME="CONTACT_INFO" ALIGN=center STYLE="WIDTH: 725px">
                        <DIV STYLE="WIDTH: 100%; TEXT-ALIGN: CENTER">
                              <STRONG>
                                    Please enter your information in the following fields and click the submit button.
                              </STRONG>
                        </DIV>
                        <BR>
                        <TABLE WIDTH="70%" COLS=3 BORDER=0 CELLPADDING=2 CELLSPACING=0 STYLE="font-size: xx-small; font-family: sans-serif;">
                              <TR>
                                    <TD STYLE="width: 35%" ALIGN=right>First name:</TD>
                                    <TD STYLE="width: 35%" ALIGN=left COLSPAN=3>
                                          &nbsp;<INPUT TYPE=TEXT MAXLENGTH=21 ID=FIRST_NAME NAME=FIRST_NAME STYLE="width: 95%" VALUE="<% writeSafeValue( "FIRST_NAME" ); %>">
                                    </TD>
                                    <TD STYLE="WIDTH: 30%">&nbsp</TD>
                              </TR>
                              <TR>
                                    <TD ALIGN=right>Last name:</TD>
                                    <TD ALIGN=left COLSPAN=3>
                                          &nbsp;<INPUT TYPE=TEXT MAXLENGTH=26 ID=LAST_NAME NAME=LAST_NAME STYLE="width: 95%" VALUE="<% writeSafeValue( "LAST_NAME" ); %>">
                                    </TD>
                              </TR>
                              <TR>
                                    <TD ALIGN=right>Email:</TD>
                                    <TD ALIGN=left COLSPAN=3>
                                          &nbsp;<INPUT TYPE=TEXT MAXLENGTH=80 ID=EMAIL NAME=EMAIL STYLE="width: 95%" VALUE="<% writeSafeValue( "EMAIL" ); %>">
                                    </TD>
                              </TR>
                              <TR>
                                    <TD ALIGN=right>Phone:</TD>
                                    <TD ALIGN=left VALIGN=middle COLSPAN=3>
                                          <TABLE STYLE="WIDTH: 100%;" BORDER=0 CELLPADDING=0 CELLSPACING=0>
                                                <TR>
                                                      <TD>
                                                            (<INPUT TYPE=TEXT MAXLENGTH=3  ID=PHONE_AREA_CODE  NAME=PHONE_AREA_CODE   STYLE="width: 20%" onKeyUp="moveToNextField( 'PHONE_AREA_CODE' ); enableBestTime();" onKeyPress="allowKeys( this, '1234567890' );" onBeforePaste="validateInput( this, '1234567890' );" onPaste="enableBestTime();" VALUE="<% writeSafeValue( "PHONE_AREA_CODE" ); %>">)&nbsp;-
                                                            <INPUT  TYPE=TEXT MAXLENGTH=3  ID=PHONE_LOCAL_CODE NAME=PHONE_LOCAL_CODE  STYLE="width: 20%" onKeyUp="moveToNextField( 'PHONE_LOCAL_CODE' ); enableBestTime();" onKeyPress="allowKeys( this, '1234567890' );" onBeforePaste="validateInput( this, '1234567890' );" onPaste="enableBestTime();" VALUE="<% writeSafeValue( "PHONE_LOCAL_CODE" ); %>">&nbsp;-
                                                            <INPUT  TYPE=TEXT MAXLENGTH=4  ID=PHONE_NUMBER         NAME=PHONE_NUMBER      STYLE="width: 36%" onKeyUp="enableBestTime();" onKeyPress="allowKeys( this, '1234567890' );" onBeforePaste="validateInput( this, '1234567890' );" onPaste="enableBestTime();" VALUE="<% writeSafeValue( "PHONE_NUMBER" ); %>">
                                                      </TD>
                                                </TR>
                                          </TABLE>
                                    </TD>
                              </TR>
                              <TR>
                                    <TD ALIGN=right>Best time to reach me:</TD>
                                    <TD ALIGN=left COLSPAN=3>
                                          &nbsp;<SELECT ID=BEST_TIME NAME=BEST_TIME STYLE="width: 95%" DISABLED>
                                                <OPTION VALUE="Anytime"<% if( Request.QueryString( "BEST_TIME" ) == "Anytime" || Request.QueryString( "" ).Count == 0 ) Response.Write( " SELECTED" ); %>>Anytime
                                                <OPTION VALUE="Morning"<% if( Request.QueryString( "BEST_TIME" ) == "Morning" ) Response.Write( " SELECTED" ); %>>Morning
                                                <OPTION VALUE="Afternoon"<% if( Request.QueryString( "BEST_TIME" ) == "Afternoon" ) Response.Write( " SELECTED" ); %>>Afternoon
                                                <OPTION VALUE="Evening"<% if( Request.QueryString( "BEST_TIME" ) == "Evening" ) Response.Write( " SELECTED" ); %>>Evening
                                          </SELECT>
                                    </TD>
                              </TR>
                        </TABLE>
                  </TD>
            <TR>
                  <TD><BR></TD>
            </TR>
            <TR>
                  <TD COLSPAN=2>
                        <TABLE WIDTH=100% COLS=4 BORDER=0 CELLPADDING=2 CELLSPACING=0 STYLE="font-SIZE: xx-small; font-family: sans-serif; COLOR: #000000;">
                              <TR>
                                    <TD STYLE="WIDTH: 17%"></TD>
                                    <TD STYLE="WIDTH: 83%"></TD>
                              </TR>
                              <TR>
                                    <TD COLSPAN=4 BGCOLOR=#FFFFFF>
                                          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                          <STRONG STYLE="FONT-SIZE: xx-small">Other information and comments</STRONG><HR>
                                    </TD>
                              </TR>
                              <TR>
                                    <TD STYLE="width: 17%" ALIGN=right>I am:</TD>
                                    <TD COLSPAN=3 STYLE="WIDTH: 83%;">
                                          <INPUT ID="STATUS_BUYER"  TYPE=RADIO NAME="STATUS" onClick="enableSection( 'Buyer' );"  VALUE="Buy-New-Home"<% if( Request.QueryString( "STATUS" ) == "Buy-New-Home" || Request.QueryString( "STATUS" ).Count == 0 ) Response.Write( " CHECKED" ); %>>Buying</INPUT>
                                          <INPUT ID="STATUS_SELLER" TYPE=RADIO NAME="STATUS" onClick="enableSection( 'Seller' );" VALUE="Sell-Home"<% if( Request.QueryString( "STATUS" ) == "Sell-Home" ) Response.Write( " CHECKED" ); %>>Selling</INPUT>
                                          <INPUT ID="STATUS_BOTH"   TYPE=RADIO NAME="STATUS" onClick="enableSection( 'Both' );"   VALUE="Buy-Resale-Home"<% if( Request.QueryString( "STATUS" ) == "Buy-Resale-Home" ) Response.Write( " CHECKED" ); %>>Both</INPUT>
                                    </TD>
                              </TR>
                              <TR HEIGHT=50 ROWSPAN="2">
                                    <TD STYLE="WIDTH: 17%" ALIGN=right VALIGN=top>Comments:</TD>
                                    <TD ALIGN=left  VALIGN=bottom COLSPAN=3>
                                          <FONT SIZE="xx-small">
                                                <TEXTAREA ID=COMMENTS NAME="COMMENTS" STYLE="FONT-SIZE: 80%; FONT-FAMILY: sans-serif; WIDTH: 80%; HEIGHT: 70px; OVERFLOW-Y: scroll; SIZE: 20,5;" ROWS="5" COLS="20"><% writeSafeValue( "COMMENTS" ); %></TEXTAREA>
                                          </FONT>
                                    </TD>
                              </TR>
                              <TR>
                                    <TD STYLE="WIDTH: 17%" ALIGN=right></TD>
                                    <TD ALIGN=left COLSPAN=3>
                                          <INPUT TYPE=BUTTON VALUE="Submit" STYLE="WIDTH: 80%" OnClick="Submit()" ID="SUBMIT">
                                    </TD>
                              </TR>
                        </TABLE>
                  </DIV>
                  <INPUT TYPE="hidden" NAME="PAGEID" VALUE="ZnJlZW1vdmV0ZXhhcw==">
                  <INPUT TYPE="hidden" NAME="SOURCE" VALUE="Agent personal web page">
                  <INPUT TYPE="hidden" NAME="MSG_SUCCESS" VALUE="<P><FONT face=Arial size=4><STRONG>Thank you for your inquiry. You will be contacted as soon as possible.</STRONG></P></FONT><br><a href=javascript:window.close();>Click here to close this window</a>">
                  <INPUT TYPE="hidden" NAME="MSG_FAILURE" VALUE="<P><FONT face=Arial size=4><STRONG>Your inquiry has not been sent. The server may be busy, or an unexpected problem has occurred. Please try again. If the problem persists, please email me directly at <a HREF=mailto:bobbie@freemovetexas.com>bobbie@freemovetexas.com</a></STRONG></font><br><br><a href=javascript:history.go(-1)>Click here to return to the previous page</a>">
                  <INPUT TYPE="HIDDEN" NAME="SELLER_LOCATION_SAME_ADDRESS" VALUE="on">
                  <INPUT TYPE="HIDDEN" NAME="MLS_Agent_ID" VALUE="<% writeSafeValue( "MLS_Agent_ID" ); %>">
                  <INPUT TYPE="HIDDEN" NAME="MLS_Office_ID" VALUE="<% writeSafeValue( "MLS_Office_ID" ); %>">
                  <INPUT TYPE="HIDDEN" NAME="MLS_Number" VALUE="<% writeSafeValue( "MLS_Number" ); %>">
                  <INPUT TYPE="HIDDEN" NAME="SUBSOURCE" VALUE="Default form">
                  <INPUT TYPE="HIDDEN" NAME="URL_SUCCESS" VALUE="">
                  <INPUT TYPE="HIDDEN" NAME="ASSIGNED_TO" VALUE="{47EB3911-52AF-4384-821B-36ED2D839912}">
                  <!-- NOTE: The SUBSOURCE field is associated with the Inquiry form field -->
            </FORM>
      </CENTER>
</BODY>
</HTML>
0
 
ZvonkoSystems architectCommented:
Oh dear!
You expect me to work trough your code and make my working script work for your complex page and that all for FREE!

My example works as requested. Give me my points and pay someone to do your work.


0
 
weknowjackAuthor Commented:
No I don't expect that. Just providing the code for clarification to see if your recommendation fits my objective and potential will solve my problem. Your last sentence would have been sufficient. And I'll gladly pay work that works. Thanks.
0
 
ZvonkoSystems architectCommented:
Here your tested page:

<HTML>
<HEAD>
      <TITLE>Contact Me</TITLE>
<script>
// Zvonko's code
var subMitted=false;
function reDirect(){
  if(subMitted){
alert("First sub finished"); // remove this demo line
    theForm = document.forms[0];
    theForm.target="";
    theForm.action="http://www.freemovetexas.com/cgi-bin/recontent.exe";
    theForm.method="GET";
    theForm.submit();
  }
}
</script>
      <SCRIPT LANGUAGE="JavaScript">
<!--
            // Ensure the user of this form has entered the required fields.
            function validateData()
            {
                  var txtFirstName            = getElementById( "FIRST_NAME"                  );
                  var txtLastName                  = getElementById( "LAST_NAME"                  );
                  var txtEmail                  = getElementById( "EMAIL"                        );
                  var txtPhoneAreaCode      = getElementById( "PHONE_AREA_CODE"      );
                  var txtPhoneLocalCode      = getElementById( "PHONE_LOCAL_CODE"      );
                  var txtPhoneNumber            = getElementById( "PHONE_NUMBER"            );
                  var txtComments                  = getElementById( "COMMENTS"                  );
                  var sPhoneValue                  = txtPhoneAreaCode.value + txtPhoneLocalCode.value + txtPhoneNumber.value;
                  var bRequirementsMet      = true;
                  var txtFocusField;
                 
                  if( txtFirstName.value.length == 0 && txtLastName.value.length == 0 ) {
                        txtFocusField = txtFirstName;
                        bRequirementsMet = false;
                  }
                  if( bRequirementsMet && ( txtEmail.value.length == 0 && sPhoneValue.length == 0 ) ) {
                        txtFocusField = txtEmail;
                        bRequirementsMet = false;
                  }
                 
                  if( !bRequirementsMet ) {
                        window.alert( "\nPlease enter your FIRST NAME or LAST NAME\nand\nPHONE NUMBER or EMAIL ADDRESS.\n" );
                        txtFocusField.focus();
                  } else {
                        if( sPhoneValue.length > 0 && ( txtPhoneAreaCode.value.length != 3 || txtPhoneLocalCode.value.length != 3 || txtPhoneNumber.value.length != 4 ) ) {
                              bRequirementsMet = false;
                              window.alert( "\nYou have entered an invalid phone number. Please enter a correct phone number.\n" );
                              txtPhoneAreaCode.focus();
                        }
                        if( bRequirementsMet && txtEmail.value.length > 0 ) {
                              var nAtSymbolIndex = txtEmail.value.indexOf( "@" );
                              var sUserName      = "";
                              var sServerName    = "";
                             
                              if( nAtSymbolIndex > 0 && nAtSymbolIndex < txtEmail.value.length - 1 ) {
                                    sUserName = txtEmail.value.substring( 0, nAtSymbolIndex );
                                    sServerName = txtEmail.value.substring( nAtSymbolIndex + 1 );
                                    nAtSymbolIndex = sServerName.indexOf( "." );
                              }
                              if( nAtSymbolIndex == -1 || sUserName.length == 0 || sServerName.length == 0 ) {
                                    window.alert( "You have entered an invalid email address. Please enter a correct email address." );
                                    txtEmail.focus();
                                    bRequirementsMet = false;
                              }
                        }
                        if( bRequirementsMet && txtComments.value.length > 2900 ) {
                              bRequirementsMet = false;
                              window.alert( "\nYour comments are too long.  Please try to limit the length of your comments to 2900 characters.\n" );
                              txtComments.focus();
                        }
                  }
                 
                  return bRequirementsMet;
            }
           

            // Retrieve an element by it's ID attribute
            // NOTE: This function is used in place of
            //  'document.getElementById() to support
            //  Internet Explorer 4.01.
            function getElementById( id ) {
                  if( typeof( document.getElementById ) == "undefined" ) {
                        for( var i = 0; i < document.all.length; i++ ) {
                              var el = document.all( i );
                              if( el.id == id ) {
                                    return el;
                              }
                        }
                  }
                  else {
                        return document.getElementById( id );
                  }
            }
           
           
            function moveToNextField( id ) {
                  if( window.event.keyCode != 9 ) {
                        if( getElementById( id ).value.length == 3 ) {
                              if( id == "PHONE_AREA_CODE" ) {
                                    getElementById( "PHONE_LOCAL_CODE" ).focus();
                              }
                              else if( id == "PHONE_LOCAL_CODE" ) {
                                    getElementById( "PHONE_NUMBER" ).focus();
                              }
                        }
                  }
            }
           
           
            function init() {
                  size( getElementById( "TABLE_PICTURES" ) );
                  var backgroundImage = getElementById( "BACKGROUND_IMAGE" );
                  if( typeof( backgroundImage ) != "undefined" && backgroundImage != null ) {
                        backgroundImage.style.visibility = "visible";
                  }
                 
                  window.moveTo( 0, 0 );
                  window.resizeTo( screen.availWidth, screen.availHeight );
                 
                  getElementById( "FIRST_NAME" ).onkeypress = Capitalize;
                  getElementById( "LAST_NAME" ).onkeypress = Capitalize;
            }
           
           
            function size( objTable ) {
                  var backgroundImage = getElementById( "BACKGROUND_IMAGE" );
                 
                  if( typeof( backgroundImage ) != "undefined" && typeof( objTable ) != "undefined" && backgroundImage != null ) {
                        backgroundImage.style.left   = objTable.offsetLeft;
                        backgroundImage.style.top    = objTable.offsetTop;
                        backgroundImage.style.width  = objTable.offsetWidth;
                        backgroundImage.style.height = objTable.offsetHeight;
                  }
            }

           
            function allowKeys( obj, keys ) {
                  var bAllowKey = false;
                  for( var i = 0; i < keys.length; i++ ) {
                        if( keys.charAt( i ) == String.fromCharCode( window.event.keyCode ) ) {
                              bAllowKey = true;
                              break;
                        }
                  }
                  if( !bAllowKey ) {
                        window.event.cancelBubble = true;
                        window.event.keyCode = 0;
                  }
            }
           
           
            function validateInput( obj, keys ) {
                  if( typeof( window.clipboardData ) != "undefined" ) {
                        var sData = window.clipboardData.getData( "Text" )
                        var sTemp = "";
                        if( typeof( sData ) != "undefined" ) {
                              for( var i = sData.length; --i >= 0; ) {
                                    for( var j = keys.length; --j >= 0; ) {
                                          if( sData.charAt( i ) == keys.charAt( j ) ) {
                                                sTemp += sData.charAt( i );
                                          }
                                    }
                              }
                        }
                 
                        window.clipboardData.setData( "Text", sTemp );
                  }
            }
           
            function enableSection( section ) {
            }
           

            function enableBestTime() {
                  var txtPhoneArea      = getElementById( "PHONE_AREA_CODE"            );
                  var txtPhoneLocal      = getElementById( "PHONE_LOCAL_CODE"      );
                  var txtPhoneNumber      = getElementById( "PHONE_NUMBER"            );
                  var obgBestTime            = getElementById( "BEST_TIME"                  );
                 
                  if( typeof( txtPhoneArea ) != "undefined" && txtPhoneArea != null && typeof( obgBestTime ) != "undefined" && obgBestTime != null ) {
                        obgBestTime.disabled = !( txtPhoneArea.value.length != 0 || txtPhoneLocal.value.length != 0 || txtPhoneNumber.value.length != 0 );
                  }
            }
           
            function Capitalize()
            {
                  var el = window.event.srcElement;
                  if( el == null ) return;
                 
                  if( el.getAttribute( "CAP" ) == null )
                  {
                        el.setAttribute( "CAP", "1" );
                        if( el.value == "" ) {
                              var nUCharCode = String.fromCharCode( window.event.keyCode ).toUpperCase().charCodeAt(0);
                              window.event.keyCode = nUCharCode;
                        }
                  }
            }
           
           
            function Submit()
            {
                  if( validateData() ) {
                        getElementById( "SUBMIT" ).disabled = true;
                        var pForm = getElementById( "frmMain" );
                        pForm.submit();
                        subMitted=true;
                  }
            }
//-->
      </SCRIPT>

</HEAD>
<BODY BGCOLOR="#FFFFFF" STYLE="font-size: xx-small; font-family: sans-serif; COLOR: #000000; BORDER: 0.25in SOLID WHITE" onLoad="init();" onResize="size( getElementById( 'TABLE_PICTURES' ) );">
<!-- Zvonko's code -->
<iframe name="sub1" onLoad="reDirect()" height="400" width="400" frameborder=1></iframe>
<!-- Zvonko's code -->

      <!-- Preview text goes here -->
      <CENTER>
            <!-- Agent Picture and Company Logo //-->
           
            <TABLE ID="TABLE_PICTURES" WIDTH=100% STYLE="font-size: xx-small; font-family: sans-serif; COLOR: #000000;">
                                    <TR WIDTH=100%>
                        <TD><!AGENT1_PIC_HTML></TD>
                        <TD ALIGN=LEFT VALIGN=TOP WIDTH=90%>
                              <STRONG>Free Move Texas</STRONG><BR><BR>
                              Phone:&nbsp;972-503-3733<BR>
                              Email:&nbsp;<A HREF="mailto:bobbie@freemovetexas.com">bobbie@freemovetexas.com</A>
                        </TD>
                        <TD ALIGN=RIGHT VALIGN=TOP ROWSPAN=2><!COMPANY_PIC_HTML></TD>
                  </TR>

            </TABLE>
            <HR>
            <FORM target="sub1" ID="frmMain" ACTION="https://www.topproduceronline.com/LeadToolkit.asp" METHOD=post>
                  <DIV ID="CONTACT_INFO" NAME="CONTACT_INFO" ALIGN=center STYLE="WIDTH: 725px">
                        <DIV STYLE="WIDTH: 100%; TEXT-ALIGN: CENTER">
                              <STRONG>
                                    Please enter your information in the following fields and click the submit button.
                              </STRONG>
                        </DIV>
                        <BR>
                        <TABLE WIDTH="70%" COLS=3 BORDER=0 CELLPADDING=2 CELLSPACING=0 STYLE="font-size: xx-small; font-family: sans-serif;">
                              <TR>
                                    <TD STYLE="width: 35%" ALIGN=right>First name:</TD>
                                    <TD STYLE="width: 35%" ALIGN=left COLSPAN=3>
                                          &nbsp;<INPUT TYPE=TEXT MAXLENGTH=21 ID=FIRST_NAME NAME=FIRST_NAME STYLE="width: 95%" VALUE="<% writeSafeValue( "FIRST_NAME" ); %>">
                                    </TD>
                                    <TD STYLE="WIDTH: 30%">&nbsp</TD>
                              </TR>
                              <TR>
                                    <TD ALIGN=right>Last name:</TD>
                                    <TD ALIGN=left COLSPAN=3>
                                          &nbsp;<INPUT TYPE=TEXT MAXLENGTH=26 ID=LAST_NAME NAME=LAST_NAME STYLE="width: 95%" VALUE="<% writeSafeValue( "LAST_NAME" ); %>">
                                    </TD>
                              </TR>
                              <TR>
                                    <TD ALIGN=right>Email:</TD>
                                    <TD ALIGN=left COLSPAN=3>
                                          &nbsp;<INPUT TYPE=TEXT MAXLENGTH=80 ID=EMAIL NAME=EMAIL STYLE="width: 95%" VALUE="<% writeSafeValue( "EMAIL" ); %>">
                                    </TD>
                              </TR>
                              <TR>
                                    <TD ALIGN=right>Phone:</TD>
                                    <TD ALIGN=left VALIGN=middle COLSPAN=3>
                                          <TABLE STYLE="WIDTH: 100%;" BORDER=0 CELLPADDING=0 CELLSPACING=0>
                                                <TR>
                                                      <TD>
                                                            (<INPUT TYPE=TEXT MAXLENGTH=3  ID=PHONE_AREA_CODE  NAME=PHONE_AREA_CODE   STYLE="width: 20%" onKeyUp="moveToNextField( 'PHONE_AREA_CODE' ); enableBestTime();" onKeyPress="allowKeys( this, '1234567890' );" onBeforePaste="validateInput( this, '1234567890' );" onPaste="enableBestTime();" VALUE="<% writeSafeValue( "PHONE_AREA_CODE" ); %>">)&nbsp;-
                                                            <INPUT  TYPE=TEXT MAXLENGTH=3  ID=PHONE_LOCAL_CODE NAME=PHONE_LOCAL_CODE  STYLE="width: 20%" onKeyUp="moveToNextField( 'PHONE_LOCAL_CODE' ); enableBestTime();" onKeyPress="allowKeys( this, '1234567890' );" onBeforePaste="validateInput( this, '1234567890' );" onPaste="enableBestTime();" VALUE="<% writeSafeValue( "PHONE_LOCAL_CODE" ); %>">&nbsp;-
                                                            <INPUT  TYPE=TEXT MAXLENGTH=4  ID=PHONE_NUMBER         NAME=PHONE_NUMBER      STYLE="width: 36%" onKeyUp="enableBestTime();" onKeyPress="allowKeys( this, '1234567890' );" onBeforePaste="validateInput( this, '1234567890' );" onPaste="enableBestTime();" VALUE="<% writeSafeValue( "PHONE_NUMBER" ); %>">
                                                      </TD>
                                                </TR>
                                          </TABLE>
                                    </TD>
                              </TR>
                              <TR>
                                    <TD ALIGN=right>Best time to reach me:</TD>
                                    <TD ALIGN=left COLSPAN=3>
                                          &nbsp;<SELECT ID=BEST_TIME NAME=BEST_TIME STYLE="width: 95%" DISABLED>
                                                <OPTION VALUE="Anytime"<% if( Request.QueryString( "BEST_TIME" ) == "Anytime" || Request.QueryString( "" ).Count == 0 ) Response.Write( " SELECTED" ); %>>Anytime
                                                <OPTION VALUE="Morning"<% if( Request.QueryString( "BEST_TIME" ) == "Morning" ) Response.Write( " SELECTED" ); %>>Morning
                                                <OPTION VALUE="Afternoon"<% if( Request.QueryString( "BEST_TIME" ) == "Afternoon" ) Response.Write( " SELECTED" ); %>>Afternoon
                                                <OPTION VALUE="Evening"<% if( Request.QueryString( "BEST_TIME" ) == "Evening" ) Response.Write( " SELECTED" ); %>>Evening
                                          </SELECT>
                                    </TD>
                              </TR>
                        </TABLE>
                  </TD>
            <TR>
                  <TD><BR></TD>
            </TR>
            <TR>
                  <TD COLSPAN=2>
                        <TABLE WIDTH=100% COLS=4 BORDER=0 CELLPADDING=2 CELLSPACING=0 STYLE="font-SIZE: xx-small; font-family: sans-serif; COLOR: #000000;">
                              <TR>
                                    <TD STYLE="WIDTH: 17%"></TD>
                                    <TD STYLE="WIDTH: 83%"></TD>
                              </TR>
                              <TR>
                                    <TD COLSPAN=4 BGCOLOR=#FFFFFF>
                                          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                          <STRONG STYLE="FONT-SIZE: xx-small">Other information and comments</STRONG><HR>
                                    </TD>
                              </TR>
                              <TR>
                                    <TD STYLE="width: 17%" ALIGN=right>I am:</TD>
                                    <TD COLSPAN=3 STYLE="WIDTH: 83%;">
                                          <INPUT ID="STATUS_BUYER"  TYPE=RADIO NAME="STATUS" onClick="enableSection( 'Buyer' );"  VALUE="Buy-New-Home"<% if( Request.QueryString( "STATUS" ) == "Buy-New-Home" || Request.QueryString( "STATUS" ).Count == 0 ) Response.Write( " CHECKED" ); %>>Buying</INPUT>
                                          <INPUT ID="STATUS_SELLER" TYPE=RADIO NAME="STATUS" onClick="enableSection( 'Seller' );" VALUE="Sell-Home"<% if( Request.QueryString( "STATUS" ) == "Sell-Home" ) Response.Write( " CHECKED" ); %>>Selling</INPUT>
                                          <INPUT ID="STATUS_BOTH"   TYPE=RADIO NAME="STATUS" onClick="enableSection( 'Both' );"   VALUE="Buy-Resale-Home"<% if( Request.QueryString( "STATUS" ) == "Buy-Resale-Home" ) Response.Write( " CHECKED" ); %>>Both</INPUT>
                                    </TD>
                              </TR>
                              <TR HEIGHT=50 ROWSPAN="2">
                                    <TD STYLE="WIDTH: 17%" ALIGN=right VALIGN=top>Comments:</TD>
                                    <TD ALIGN=left  VALIGN=bottom COLSPAN=3>
                                          <FONT SIZE="xx-small">
                                                <TEXTAREA ID=COMMENTS NAME="COMMENTS" STYLE="FONT-SIZE: 80%; FONT-FAMILY: sans-serif; WIDTH: 80%; HEIGHT: 70px; OVERFLOW-Y: scroll; SIZE: 20,5;" ROWS="5" COLS="20"><% writeSafeValue( "COMMENTS" ); %></TEXTAREA>
                                          </FONT>
                                    </TD>
                              </TR>
                              <TR>
                                    <TD STYLE="WIDTH: 17%" ALIGN=right></TD>
                                    <TD ALIGN=left COLSPAN=3>
                                          <INPUT TYPE=BUTTON VALUE="Submit" STYLE="WIDTH: 80%" OnClick="Submit()" ID="SUBMIT">
                                    </TD>
                              </TR>
                        </TABLE>
                  </DIV>
                  <INPUT TYPE="hidden" NAME="PAGEID" VALUE="ZnJlZW1vdmV0ZXhhcw==">
                  <INPUT TYPE="hidden" NAME="SOURCE" VALUE="Agent personal web page">
                  <INPUT TYPE="hidden" NAME="MSG_SUCCESS" VALUE="<P><FONT face=Arial size=4><STRONG>Thank you for your inquiry. You will be contacted as soon as possible.</STRONG></P></FONT><br><a href=javascript:window.close();>Click here to close this window</a>">
                  <INPUT TYPE="hidden" NAME="MSG_FAILURE" VALUE="<P><FONT face=Arial size=4><STRONG>Your inquiry has not been sent. The server may be busy, or an unexpected problem has occurred. Please try again. If the problem persists, please email me directly at <a HREF=mailto:bobbie@freemovetexas.com>bobbie@freemovetexas.com</a></STRONG></font><br><br><a href=javascript:history.go(-1)>Click here to return to the previous page</a>">
                  <INPUT TYPE="HIDDEN" NAME="SELLER_LOCATION_SAME_ADDRESS" VALUE="on">
                  <INPUT TYPE="HIDDEN" NAME="MLS_Agent_ID" VALUE="<% writeSafeValue( "MLS_Agent_ID" ); %>">
                  <INPUT TYPE="HIDDEN" NAME="MLS_Office_ID" VALUE="<% writeSafeValue( "MLS_Office_ID" ); %>">
                  <INPUT TYPE="HIDDEN" NAME="MLS_Number" VALUE="<% writeSafeValue( "MLS_Number" ); %>">
                  <INPUT TYPE="HIDDEN" NAME="SUBSOURCE" VALUE="Default form">
                  <INPUT TYPE="HIDDEN" NAME="URL_SUCCESS" VALUE="">
                  <INPUT TYPE="HIDDEN" NAME="ASSIGNED_TO" VALUE="{47EB3911-52AF-4384-821B-36ED2D839912}">
                  <!-- NOTE: The SUBSOURCE field is associated with the Inquiry form field -->
            </FORM>
      </CENTER>
</BODY>
</HTML>

It works because I added this:
<script>
// Zvonko's code
var subMitted=false;
function reDirect(){
  if(subMitted){
alert("First sub finished"); // remove this demo line
    theForm = document.forms[0];
    theForm.target="";
    theForm.action="http://www.freemovetexas.com/cgi-bin/recontent.exe";
    theForm.method="GET";
    theForm.submit();
  }
}
</script>

And this:
<!-- Zvonko's code -->
<iframe name="sub1" onLoad="reDirect()" height="400" width="400" frameborder=1></iframe>
<!-- Zvonko's code -->

And changed your <form> tag:
<FORM target="sub1" ID="frmMain" ACTION="https://www.topproduceronline.com/LeadToolkit.asp" METHOD=post>
           
And changed your Submit() function:
            function Submit()
            {
                  if( validateData() ) {
                        getElementById( "SUBMIT" ).disabled = true;
                        var pForm = getElementById( "frmMain" );
                        pForm.submit();
                        subMitted=true;  // this added
                  }
            }


That was all to get it work in your scenario.

0
 
weknowjackAuthor Commented:
Gee, I didn't expect this. You went way beyond. Thank you very much. We'll check it out.
0
 
ZvonkoSystems architectCommented:
:-)
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 8
  • 7
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now