Solved

Evaluate my program

Posted on 1997-10-02
3
245 Views
Last Modified: 2011-09-20
Please evaluate my Javascript program which collects all the form inputs and mails to a email account. My users have various versions of Netscape and some of them have the warning message box which comes off before submitting a form. My problem is, if the user waits for a few more seconds than the timeout period to hit OK in the warning box, then the program doesn't work.

Is there a solution to fix this problem. Also, I am able to disable the Form Submit Warning box in Netscape 3.0 and am not able to do that in Netscape Communicator 4.02
=====================================================
<HTML>

<HEAD><TITLE>MSP Systems Feedback Form</TITLE>

<SCRIPT>

function response()

      {
          location.href="http://msp03.msp.sc.ti.com/";
      }

</SCRIPT>


<SCRIPT LANGUAGE="JavaScript">
<!--

function mailIt(form) {
  var data = document.dataForm
  var userInfo = ""

  form.action += "?subject=" + data.subject.value
  userInfo += "Page Title:  " + document.title + "\n"
  userInfo += "Mailed From: " + document.location + "\n\n"
  form.mailBody.value = userInfo + data.body.value
  location.href="http://msp03.msp.sc.ti.com/";
  return true
}
// -->
</SCRIPT>



</HEAD>

<BODY BGCOLOR="#FFFFFF" TEXT=navy LINK=red VLINK=red>

<center>
<TABLE BORDER=3 CELLSPACING=5  width=600>
<tr>
<th><a href="/index.html"><FONT COLOR="black">MSP Business Systems</a></th>
<th><a href="/reports.html"><FONT COLOR="black">MSP Reports Home</a></th>
</tr>
</TABLE>
</center>
<CENTER>

<TABLE>
<FORM NAME="dataForm">
  <TR>
  <TH ALIGN=right>Name:
  <TD><INPUT NAME="name" SIZE=40 >
 </TR>


 <!-- DELETE THIS TABLE ROW IF YOU'RE HARDCODING A SUBJECT -->
 <TR>
  <TH ALIGN=right>Subject:
  <TD><INPUT NAME="subject" SIZE=40>
 </TR>
 
 <TR>
  <TH ALIGN=right VALIGN=top>Message:
  <TD><TEXTAREA NAME="body" COLS=60 ROWS=10 WRAP=virtual></TEXTAREA>
 </TR>
</FORM>

<FORM
  NAME="mailForm"
  ACTION="mailto:senthil@ti.com"
  METHOD="post"
  ENCTYPE="multipart/form-data"
  onSubmit="return mailIt(this)">
<INPUT TYPE="hidden" NAME="mailBody" VALUE="">
 <TR>
  <TD COLSPAN=2 ALIGN=center>
    <INPUT TYPE="submit" VALUE="Send This Mail Message Now" onClick='setTimeout("response()",2000)'>
</TR>
</FORM>
</TABLE>
<p>
<p>

<center><nobr><A HREF="http://www.ti.com/sc/docs/schome.htm"><IMG SRC="/OWS-IMG/scnv1.gif" ALT="Semiconductors" border=0></a><A HREF="http://www.ti.com/sc/docs/msp/msphome.htm"><IMG SRC="/OWS-IMG/scnvmsp.gif" ALT="Mixed Signal and Analog" border=0></A><A HREF="http://www.ti.com/sc/docs/search.htm"><IMG SRC="/OWS-IMG/mpsernav.gif"  border=0 ALT="Search"></A><A HREF="/sc/docs/feedback.htm"><IMG SRC="/OWS-IMG/feednav.gif"  border=0 ALT="Feedback"></A><A HREF="http://www.ti.com/corp/docs/home.htm"><IMG SRC="/OWS-IMG/tihmnav.gif"  border=0 ALT="TI Home"></A></nobr><BR></center>



<ADDRESS>

<CENTER>

<A HREF="http://www.ti.com/corp/docs/copyrght.htm">(c) Copyright</A> 1997 Texas Instruments Incorporated. All rights reserved. <BR>



<p>
<center><IMG SRC="/OWS-IMG/owsdr.gif"></center>



</CENTER>

</ADDRESS>


<CENTER>
<script language="JavaScript">
<!--
      document.write("Updated " + document.lastModified);
// -->
</script>

</CENTER>


</BODY>

</HTML>
0
Comment
Question by:senthil021397
  • 2
3 Comments
 
LVL 10

Accepted Solution

by:
kollegov earned 100 total points
ID: 1270927
Solution is easy:
You can set some semaphore variable to true
in function submitting e-mail
let it be declared as

var semaphore=null

so in function mailit()
add single row before return:

semaphore=true;

function response than can be modified:


      function response()

      { if(semaphore)
         {if(semaphore==true)
           {setTimeout('location.href="http://msp03.msp.sc.ti.com/',500}
         }
        else
         setTimeout("response()",100)
      }

Thus this function will be called recursevly each 100ms
And check was the form submited or not, if it is already submited it will set 500ms timeout for submission and change location.

You now do not need 2sec timout onClick, make it 100ms. :)

0
 

Author Comment

by:senthil021397
ID: 1270928
Kollegov,

One part of solution seems to work, Even with the Warning box enabled, the browser is still holding the data till i click OK. It doens'nt matter how long i wait. BUT, after clicking OK, location.href="http....." doesn't seem to work. It stays in the same page.
I tried a few things without success. Any thoughts..

Senthil


0
 

Author Comment

by:senthil021397
ID: 1270929
Still waiting for Solution
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Use SP.SOD.executeFunc in SharePoint Online Add-In 2 38
JS Plugin 4 29
Basic JavaScript Question 3 38
Angular - break the dataset in chunks? 7 39
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

895 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

13 Experts available now in Live!

Get 1:1 Help Now