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

Form's onsubmit is called but action is not performed

Hello,

I have a coldfusion page FileRequest.cfm. On this page, there is form in which onsubmit method is specified  - which is formatreg(). The Form has  ACTION="<CFOUTPUT>#APPLICATION.ServerURL#</CFOUTPUT>/file/fileRequest.cfm"
which is calling the same page i.e. filerequest.cfm

What happens is when I click on submit button, this onsubmit method(formatreg  ) is called but the action is never performed i.e.  "<CFOUTPUT>#APPLICATION.ServerURL#</CFOUTPUT>/file/fileRequest.cfm"
is never called, so the page just stays there and does nothing....

This happens on just one client's machine. I donot know what browser settings on his machine are causing this. Is it becos of browser settings or something else. Client is using IE 6  and Coldfusion version is 7 .

I read @ problems with onsubmit method on http://www.htmlcodetutorial.com/forms/_FORM_onSubmit.html. It says that since its javascript it does give some problems and it says to check cgi script. but since this does not happen on all the machines, i donot think its this issuse...

I have pasted the code below...

Pl help...

Thanks
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

<CFIF #parameterexists(vadd)# is "Yes">
  <CFOUTPUT>
    <CFIF #filetype# is "F" AND #IsDate(enddate)# is "No">
                  <SCRIPT LANGUAGE="JavaScript">
            alert("Your end date (#enddate#) is not a valid date.\nPlease enter with a format of MM/DD/YYYY.")
            history.back()
            </SCRIPT>
        </CFIF>

    <CFIF #len(filetext)# LT 1>
                 <SCRIPT LANGUAGE="JavaScript">
            alert("You must provide text \nfor your file.")
            history.back()
           </SCRIPT>
    </CFIF>
  </CFOUTPUT>

  <CFLOCATION URL="fileThanks.cfm?A=#Variable.Action#">
</CFIF>  

<HTML>
<head>
<SCRIPT LANGUAGE="JavaScript">
function formatReg(form)
  {
   if (form.Email.value.length ==0)
     {
           alert("Please provide your e-mail address");
           form.Email.focus();
           return false;
         }

  }
</SCRIPT>

<script language="javascript" >
  function selfileType_SetDisplay ()
    {
     var trEndDate = document.all.item("trEndDate");
     var selfileType = document.all.item("filetype");

         if (selfileType.value == "F")
       {
        trEndDate.style.display="inline";
           }
         else
       {
        trEndDate.style.display="none";
           }
         return true;
        }
</script>

</head>

<body bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" onload="selfileType_SetDisplay()">

<p align="center"><font face="Arial" color="#000080" size="2">Please make sure that you fill out
all of the fields in </font><font face="Arial" color="#FF0000" size="2">red</font><font
face="Arial" color="#000080">.</font></p>
<FORM METHOD="post" onSubmit="return formatReg(this)" ACTION="<CFOUTPUT>#APPLICATION.ServerURL#</CFOUTPUT>/file/fileRequest.cfm">
       
      <table align="Center" border="4" cellpadding="6" cellspacing="2" width="90%">

      <TR><TD COLSPAN="2" ALIGN="Center" BGCOLOR="#000091">
                <FONT FACE="Arial" COLOR="#FFFFFF" SIZE="-1">
</FONT>
          </TD></TR>

    <TR>
                 <TD BGCOLOR="EEEEEE">First Name</TD>
                 <td> <INPUT TYPE="text" NAME="firstname" SIZE="25" MAXSIZE="" VALUE=""><br></TD>
    </tr>

    <tr>
         <TD BGCOLOR="EEEEEE">Last Name</TD>
         <td> <INPUT TYPE="text" NAME="lastname" SIZE="25" MAXSIZE="" VALUE=""><br></TD>
    </tr>

    <tr>
         <TD BGCOLOR="EEEEEE">Phone:</TD>
                 <td><INPUT TYPE="text" NAME="Phone" SIZE="25" MAXSIZE="" VALUE=""><br></TD>
    </tr>

    <tr>
        <TD BGCOLOR="EEEEEE"><font face="Arial" color="#FF0000" size="2">E-Mail</TD>
        <td> <INPUT TYPE="text" NAME="Email" SIZE="25" MAXSIZE="" VALUE=""> </TD>
    </tr>

   <tr>
                <TD BGCOLOR="EEEEEE"> <font face="Arial" color="#FF0000" size="2">file Type:</TD>
        <TD><SELECT ID="selfileType" size="1" name="filetype"  onchange="javascript:selfileType_SetDisplay ()">
             <option value="" selected >--Select Type--</option>
             <option value="G"  >General file</option>
             <option value="I"  >Incorrect File</option>
             <option value="M"  >Missing Info</option>
             <option value="F"  >Other Notes</option>
            </SELECT>
        </TD>
        </TR>

   <TR id="trEndDate" style="display:none">
        <td  BGCOLOR="EEEEEE"><font face="Arial" color="#FF0000" size="2">Other Notes End Date:</td>
        <td> <input type="text" size="10" maxlength="10" name="enddate" value=""> Format: MM/DD/YYYY</td>
    </tr>

    <tr>
             <td  BGCOLOR="EEEEEE"><font face="Arial" color="#FF0000" size="2">file Text:</td>
                 <TD>  <TEXTAREA NAME="filetext" ROWS=6 COLS=50 wrap=hard></TEXTAREA> </TD>
    </tr>

    <tr>
             <td COLSPAN="2" ALIGN="Center">
                      <input type="submit" value="Submit" NAME="vadd">
                      <input type="button" value=" Cancel " onclick="window.close()">
        </td>
    </tr>
   </table>
   </td>
  </tr>
 </table>

 
</form>
 
</body>
</html>






0
at999
Asked:
at999
  • 2
1 Solution
 
tdlewisCommented:
You will probably have more luck if you post this in the following zone:
Internet > Web Development > Web > Coldfusion Studio
0
 
at999Author Commented:
thanks tdlewis for the reply,
but i think this is issue with cgi/IIS (I donot know anything in CGI)

But I read @ problems with onsubmit method(onsubmit method is called when the form is submitted) on http://www.htmlcodetutorial.com/forms/_FORM_onSubmit.html. It says that since its javascript it does give some problems and it says to check cgi script.
thats why i placed in CGI section
0
 
tdlewisCommented:
The action of your form is .../fileRequest.cfm so the "CGI" that is being executed is a ColdFusion file.

As for your onsubmit method, it is called between the time the "Submit" button is clicked and the form is sent to the server. Its purpose is to determine whether the form should be sent to the server or not. If formatReg returns false then the browser will not send the form to the server; in the code you supplied, the only thing that would prevent the form from being submitted is for form.Email.value.length == 0.

Assuming that the email field is not blank, the data is sent to the server. In that case, you need to look at fileRequest.cfm and determine why it is not doing what you expect.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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