1

I use JQuery Validation Plugin to validate my form and it works for all fields,
but when I try to use it for <input type="file" id="ProjectInformation">

<script>
    $(function() {
        $("#feedback-form").validate({
            submitHandler: function(form) {
                form.submit();
            },
            rules: {
                Name: {
                    required: true,
                    minlength: 2
                },
                ProjectInformation: {
                    extension: "doc,txt,pdf",
                }
            },
            messages: {
                Name: {
                    required: "Please enter a name",
                    minlength: "Name must consist of at least 2 characters"
                },
                ProjectInformation: {
                    extension: "Only .doc, .txt, and .pdf files allowed",
                }
            }
        });
    });
</script>

I get error Uncaught TypeError: Cannot call method 'call' of undefined
What's wrong?

2
  • What's the line that the error refers to? (It's probably in the plugin's js file) Commented May 23, 2013 at 9:24
  • Yes, it's here ` } catch(e) { if ( this.settings.debug && window.console ) { console.log( "Exception occurred when checking element " + element.id + ", check the '" + rule.method + "' method.", e ); } throw e; Uncaught TypeError: Cannot call method 'call' of undefined }` Commented May 23, 2013 at 9:32

1 Answer 1

0

I have chacked extension in Validation Plugin and found that in that example they use | instead of , So Try using..

extension: "doc|txt|pdf",
Sign up to request clarification or add additional context in comments.

1 Comment

Nope, I tried, it doesnt work too, The allowed file extensions, seperated via "|" (or a comma, ",") link

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.