Help with drop down

Hi everyone I need help
How to use drop down menu, I would like when I click a menu it opens a specific page?

[Admin note: moved to this Q&A topic]

You should start a new Q&A post sjnce this is a completely separate topic. Also we need more details on what you have tried.

1 Like

Hi @chikhaoui.mongi

Please follow this guide that will help get you an answer:

Also, you may try to go through the tutorials and docs that use drop downs.

What have you tried so far? Can you paste some code or post a clone link?

@chikhaoui.mongi

Nice drawing skills :stuck_out_tongue_winking_eye:

I didn’t realise you had this question, but I answered it by coincidence on your Show and Tell post.

try this, ( make sure you import each page that you are using at the top of the client code.

self.drop_down.items = [“Inventory List”, “Place Regional order”]

self.drop_down.set_event_handler("change", self.drop_down_change)

def drop_down_change(self, **event_args):
“”“This method is called when an item is selected”“”
selected_item = self.drop_down.selected_value

  if selected_item == "Inventory List":
        self.headline_1.text = "Inventory List"
        self.open_inventory_page()
  elif selected_item == "Place Regional order":
        self.headline_1.text = "Place Regional order"
        self.open_reorder_page()

def open_inventory_page(self, **event_args):
“”“Open Inventory page in content panel”“”
self.content_panel.clear()
inventory_page = Inventory_page()
self.content_panel.add_component(inventory_page)

def open_reorder_page(self, **event_args):
“”“Open Inventory page in content panel”“”
self.content_panel.clear()
reorder_page = Reorder_Form()
self.content_panel.add_component(reorder_page)

Hi, first I’d like to thank you and inform you that I’m a geologist and never a computer scientist. Consequently, what I’m doing with computers is still at the very very beginner and rudimentary stage. Don’t think I’m an expert, but far from it. I therefore beg you to help me to deep in this doamine I love so much.

For my anvil app you’re asking me to work with the submenus. Yes, that’s what I want, but I don’t know how to do it. I think if you give me the code for the example you quoted, it could help me a lot. It’s true, I tried to read the document on routing but I didn’t understand anything.

Thank you very much