Validate Input type=file box on form submission


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Validate Input type=file box on form submission

  1. #1
    Jay Swan Guest

    Validate Input type=file box on form submission


    New JavaScript'er here...
    Any ideas on why this always to the return true case...
    TIA : Jay

    <%@ Language=VBScript %>
    <HTML>
    <HEAD>
    <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
    </HEAD>
    <BODY>

    <IMG SRC="file://C:\temp\TopFrame.gif">

    <SCRIPT language="JavaScript">
    <!--
    function VerifyData()
    {
    if (document.frmUser.subOMContent.Value != "" )
    {
    alert ("Has Selected File - Value True");
    return true;
    }
    else
    alert ("Please Select A File To Contribute To Content Management...");
    return false;

    }
    -->
    </script>

    <form action="PushContent.htm" Method=post Name=frmUser onSubmit="return
    VerifyData()">
    <Table Align="Center" Border=3>
    <tr>
    <td Align="Center">
    <strong>
    Select File For Content Management
    </strong>
    </td>
    </tr>
    <tr>
    <td> <input size=100 type=file name=subOMContent></td>
    </tr>
    <tr>
    <td Align="Center"><INPUT type="submit" value="Submit Content" id=submit1></td>
    </tr>

    </Table>
    </form>
    </BODY>
    </HTML>

    Thanks, again.
    Jay.Swan.b@Bayer.com


  2. #2
    MarkN Guest

    Re: Validate Input type=file box on form submission


    Ask this in the Javascript Discussion. This is a Java discussion.


    Mark

    "Jay Swan" <Jay.Swan.b@bayer.com> wrote:
    >
    >New JavaScript'er here...
    >Any ideas on why this always to the return true case...
    >TIA : Jay
    >
    ><%@ Language=VBScript %>
    ><HTML>
    ><HEAD>
    ><META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
    ></HEAD>
    ><BODY>
    >
    ><IMG SRC="file://C:\temp\TopFrame.gif">
    >
    ><SCRIPT language="JavaScript">
    ><!--
    > function VerifyData()
    > {
    > if (document.frmUser.subOMContent.Value != "" )
    > {
    > alert ("Has Selected File - Value True");
    > return true;
    > }
    > else
    > alert ("Please Select A File To Contribute To Content Management...");
    > return false;
    >
    > }
    >-->
    ></script>
    >
    ><form action="PushContent.htm" Method=post Name=frmUser onSubmit="return
    >VerifyData()">
    ><Table Align="Center" Border=3>
    > <tr>
    > <td Align="Center">
    > <strong>
    > Select File For Content Management
    > </strong>
    > </td>
    > </tr>
    > <tr>
    > <td> <input size=100 type=file name=subOMContent></td>
    > </tr>
    > <tr>
    > <td Align="Center"><INPUT type="submit" value="Submit Content" id=submit1></td>
    > </tr>
    >
    ></Table>
    ></form>
    ></BODY>
    ></HTML>
    >
    >Thanks, again.
    >Jay.Swan.b@Bayer.com
    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center