Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to bind a subcategory list by selecting an item in another list? #553

Closed
ZHosseinpour opened this issue Dec 22, 2014 · 2 comments
Closed

Comments

@ZHosseinpour
Copy link

i have an 'option groups' which return main categories,with selecting one main category i want to list subcategory in the drop down

@ChenRoth-old
Copy link

here's a simplified example of how you can achieve this.

in your schema

main: {
   autoform: { 
       options: ['m1','m2','m3']
  }
},

sub: {
   autoform: { 
      options: function() { 
            var main = AutoForm.getFieldValue(AutoForm.find().formId, 'main');
            switch (main) {    
                   case "m1": return ["s1a","s1b","s1c"];
                   case "m2": return ["s2a","s2b","s2c"];
                   case "m3": return ["s3a","s3b","s3c"];                
            }  
         }
     }
}

@ZHosseinpour
Copy link
Author

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants