简体   繁体   中英

Dynamic select values in form

I have form for searching through products that encapsulates three selects: material, weight, and color. These selects contain values from database.

I would like to have a following behavior:

  • If user selects material, the remaining two selects will display only values that are acceptable for products with a given material
  • Apply this to all three selects vice versa

Before I started with nette, I had been doing this using ajax and jquery/javascript by dynamically changing select elements, after user selected value in other select.

I believe in nette should be some good (system) solution, how to reload select's values in a corresponding presenter. Can you help me please?

Just look into the documentation of nette. In my opinion, this is what you are searching for: http://pla.nette.org/en/dependent-form-select-with-ajax

You can write handles for select changes, and in those handles load to form remaining selects. No messy work with javascript.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM