{"action":"created","issue":{"url":"https://api.github.com/repos/formvalidation/formvalidation/issues/1397","labels_url":"https://api.github.com/repos/formvalidation/formvalidation/issues/1397/labels{/name}","comments_url":"https://api.github.com/repos/formvalidation/formvalidation/issues/1397/comments","events_url":"https://api.github.com/repos/formvalidation/formvalidation/issues/1397/events","html_url":"https://github.com/formvalidation/formvalidation/issues/1397","id":55862492,"number":1397,"title":"Help! Changing validator on dropdown select","user":{"login":"mhtchong1989","id":9627593,"avatar_url":"https://avatars.githubusercontent.com/u/9627593?v=3","gravatar_id":"","url":"https://api.github.com/users/mhtchong1989","html_url":"https://github.com/mhtchong1989","followers_url":"https://api.github.com/users/mhtchong1989/followers","following_url":"https://api.github.com/users/mhtchong1989/following{/other_user}","gists_url":"https://api.github.com/users/mhtchong1989/gists{/gist_id}","starred_url":"https://api.github.com/users/mhtchong1989/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhtchong1989/subscriptions","organizations_url":"https://api.github.com/users/mhtchong1989/orgs","repos_url":"https://api.github.com/users/mhtchong1989/repos","events_url":"https://api.github.com/users/mhtchong1989/events{/privacy}","received_events_url":"https://api.github.com/users/mhtchong1989/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-01-29T06:36:09Z","updated_at":"2015-01-29T07:09:28Z","closed_at":null,"body":"I am currently using this validator for my project. So far the validators are working flawlessly! So I have this problem: I have 4 fields in my form namely a dropdown button, a file upload field, and 2 text fields. For the sake of this post, let's disregard the 2 text fields.\r\n\r\nI have the snippet of the bootstrapvalidator and here it is:\r\n\r\n$('#uploadFileForm')\r\n            .bootstrapValidator({\r\n                live: 'enabled',\r\n                fields: {\r\n                    'data[Upload][uploadtype]': {\r\n                        validators: {\r\n                            notEmpty: {\r\n                                message: 'Choose Upload Type'\r\n                            }\r\n                        }\r\n                    },\r\n                    'data[Upload][browsefile]': {\r\n                        validators: {\r\n                            notEmpty: {\r\n                                message: 'Choose a file to upload'\r\n                            },\r\n                            file: {\r\n                                extension: 'pdf',\r\n                                type: 'application/pdf',\r\n                                maxSize: 5120 * 5120 * 5120 * 5120 * 5120,\r\n                                message: 'The file must be in .pdf format and must not exceed 5MB in size'\r\n                            }\r\n                        }\r\n                    };\r\n\r\nSo these two validators are for the dropdown button (data[Upload][uploadtype]) and file upload field (data[Upload][browsefile]).\r\n\r\nAs you can see, my file upload field will require the user to upload a file with .pdf format and size not exceeding 5mb. This is working perfectly.\r\n\r\nNow, what I want to do is I want to change the validator of the file upload field depending on what was chosen in the dropdown field.\r\n\r\nFor example: the user chose 'PDF' in the dropdown field and the file upload field will show the validators written above. If the user chose 'Pictures' in the dropdown field, I want the file upload field validator to change as well.\r\n\r\nIs this possible?"},"comment":{"url":"https://api.github.com/repos/formvalidation/formvalidation/issues/comments/71980208","html_url":"https://github.com/formvalidation/formvalidation/issues/1397#issuecomment-71980208","issue_url":"https://api.github.com/repos/formvalidation/formvalidation/issues/1397","id":71980208,"user":{"login":"mhtchong1989","id":9627593,"avatar_url":"https://avatars.githubusercontent.com/u/9627593?v=3","gravatar_id":"","url":"https://api.github.com/users/mhtchong1989","html_url":"https://github.com/mhtchong1989","followers_url":"https://api.github.com/users/mhtchong1989/followers","following_url":"https://api.github.com/users/mhtchong1989/following{/other_user}","gists_url":"https://api.github.com/users/mhtchong1989/gists{/gist_id}","starred_url":"https://api.github.com/users/mhtchong1989/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhtchong1989/subscriptions","organizations_url":"https://api.github.com/users/mhtchong1989/orgs","repos_url":"https://api.github.com/users/mhtchong1989/repos","events_url":"https://api.github.com/users/mhtchong1989/events{/privacy}","received_events_url":"https://api.github.com/users/mhtchong1989/received_events","type":"User","site_admin":false},"created_at":"2015-01-29T07:09:28Z","updated_at":"2015-01-29T07:09:28Z","body":"Yes, exactly. I will have different kinds of file types: .jpeg, .png, .docx, .pdf, etc. So if I choose 'Pictures' in dropdown field, the file upload validator will require users to upload .jpeg or .png files. If I choose 'PDF' in dropdown field, the file upload validator will require users to upload .pdf files. And so on and so forth."}}