What I’m trying to do:
Show a dropdown when another well defined dropdown value is selected
What I’ve tried and what’s not working:
ive tried the next code the problem is that the output show me a problem which is " RecursionError: Maximum call stack size exceeded" and it was a successful result.
What the output showed me means and how can i delete that output?
Code Sample:
# this is a formatted code snippet.
# paste your code between ```
self.drop_down_3.visible= False
def drop_down_3_show(self, **event_args):
if self.drop_down_2.selected_value=="E7.1.":
self.drop_down_3.visible=True
self.drop_down_3.visible= False
Clone link:
share a copy of your app
Welcome to the forum!
That error message means that you have too much recursion…a function calling itself over and over again.
In your case, you have a function that gets called when the visible property of its component is set, and you are setting the visible property of its component inside the function. Which triggers the function again, which sets the visible property again, etc.
Eventually Anvil gets tired of doing this and gives you the error message you’re seeing.
The solution is simple…don’t set the visible property inside the show event function. You’ll need another way to accomplish what you’re trying to accomplish.
You could also play around with seeing if it is visible first, and only setting the visible property when it isn’t visible. That might limit the recursion to just a single call.
2 Likes