Hi,

<script language="JavaScript">
        function Validate()
          {
                 var image =document.getElementById("image").value;
                 if(image!=''){
                          var checkimg = image.toLowerCase();
                          if (!checkimg.match(/(\.jpg|\.png|\.JPG|\.PNG|\.jpeg|\.JPEG)$/)){
                                  alert("Please enter  Image  File Extensions .jpg,.png,.jpeg");
                                  document.getElementById("image").focus();
                                  return false;
                            }
                         }
                 return true;
         }          


         function refreshParent() {
             var URL = unescape(window.opener.location.pathname);  
             var PARMS = unescape(window.opener.location.search);

//            window.opener.location.href=window.opener.location.href;

            var ms = new Date().getTime();
            window.opener.location.href="/HousewareAdmin-web/categories_create/"+ms+PARMS;

         }

         function submitUploadForm(){   
             this.document.forms['uploadImagePopupForm'].submit();
             //window.setTimeout(refreshParent(), 1000);
             //sleep(2000);
             window.close();
             refreshParent(); 
         }

</script>
</head>
<body>
<form:form modelAttribute="categoryPageBean" name="uploadImagePopupForm" method="post"
    enctype="multipart/form-data" onSubmit="return Validate();">
    <fieldset><legend>Upload Category Image</legend>
    <table>
            <tr><td>
                    <p><form:input path="parentCategory" type="hidden" value="${parentCategory}" /></p>
                </td>
            </tr>
            <tr><td>
                    <p><form:input path="siblingCategory" type="hidden" value="${siblingCategory}" /></p>
            </td></tr>
            <tr><td>
                    <p><form:input path="childCategory" type="hidden" value="${childCategory}" /></p>
            </td></tr>

        <tr>  
            <td><form:label for="fileData" path="fileData">Image File</form:label><br />
            </td>
            <td><form:input path="fileData" id="image" type="file" /></td>
                </tr>
                <tr>
            <td><br />
            </td>
                        <!--
            <td><input type="submit" value="Upload" /></td>
                        -->
                        <td>
                        <a onClick="submitUploadForm();" data-type="submit" class="button-1" >Upload File</a>
                        </td>
        </tr>
    </table>
    </fieldset>
</form:form>
</body>
</html>

there anything wrong with my scripts?

Please post the post in javascript section.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.