0

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?

Edited by pritaeas: Moved to Javascript forum.

2
Contributors
1
Reply
3
Views
5 Years
Discussion Span
Last Post by lps
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.