Link to home
Start Free TrialLog in
Avatar of Webboy2008
Webboy2008

asked on

jquery, upload

I have generic web form in asp.net, just like contact information with name, address...and etc.

I would like to add upload button to allow user to upload document. How can I validate to make the attachment is there in jquery?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Webboy2008
Webboy2008

ASKER

that is working but I am trying to merge with my existing codes...any ideas how to that?

<script type="text/javascript">
        $(document).ready(function() {
            $("#aspnetForm").validate({
                rules: {
                     <%=txtschool.UniqueID %>: {
                        required: true
                                               
                    },
                     <%=txtschoolclass.UniqueID %>: {                        
                        required: true
                    },
                      <%=txtmajor.UniqueID %>: {                        
                        required: true
                    },
                     <%=txtprofessor.UniqueID %>: {                        
                        required: true
                    },
                    <%=txttextbook.UniqueID %>: {                        
                        required: true
                    },
                    <%=txtschoolyear.UniqueID %>: {                        
                        required: true
                    },
                    <%=txtschoolyear.UniqueID %>: {                        
                        required: true
                    },
                    <%=txttotalpagenumber.UniqueID %>: {                        
                        required: true
                    },
                }, messages:
                {
                     
                   
                }
            });
        });
    </script>
Ah, looks like you are using a validation plugin - without knowing which one can't test but would imaging it would be something like this.
Also don't know the id of your file upload control so you need to change that
<script type="text/javascript">
        $(document).ready(function() {
            $("#aspnetForm").validate({
                rules: {
                     <%=txtschool.UniqueID %>: {
                        required: true
                                               
                    },
                     <%=txtschoolclass.UniqueID %>: {                        
                        required: true
                    },
                      <%=txtmajor.UniqueID %>: {                        
                        required: true
                    },
                     <%=txtprofessor.UniqueID %>: {                        
                        required: true
                    },
                    <%=txttextbook.UniqueID %>: {                        
                        required: true
                    },
                    <%=txtschoolyear.UniqueID %>: {                        
                        required: true
                    },
                    <%=txtschoolyear.UniqueID %>: {                        
                        required: true
                    },
                    <%=txttotalpagenumber.UniqueID %>: {                        
                        required: true
                    },
                    <%=YOURFILEUPLOADBOXID %>: {                        
                        required: true
                    },
                }, messages:
                {
                     
                   
                }
            });
        });
    </script> 

Open in new window

The code is working fine.