Joldz 🔮
Joldz 🔮•4w ago

Stepper Component Question

I'm having trouble understanding how to do error checking when trying to advance the next step in the stepper but still allowing the user to go backwards. My script attached to the stepper component looks like this.
def main(stepIndex: int,month:int, year:int,preview_df_exists:list):
if stepIndex == 0:
if not month or month == 0 or not year:
raise Exception("Please Enter a Month and Year.")
elif stepIndex == 1:
if not preview_df_exists:
raise Exception("Please Upload a file ")
def main(stepIndex: int,month:int, year:int,preview_df_exists:list):
if stepIndex == 0:
if not month or month == 0 or not year:
raise Exception("Please Enter a Month and Year.")
elif stepIndex == 1:
if not preview_df_exists:
raise Exception("Please Upload a file ")
I see no way for me to know whether or not the Next or the Previous button is clicked within the stepper component itself. The On Next and On Previous event handlers are for triggering other scripts and cannot be referenced by the stepper component itself. I have thought of many ways to hack this functionality together but nothing has worked so far. Do you have any suggestions for how I can allow users to move backwards freely but when proceeding, make the validations in the script above?
2 Replies
rubenf
rubenf•4w ago
one param should be connected to lastAction
Joldz 🔮
Joldz 🔮OP•4w ago
ok so i thought about that and should've tried this route but my assumption was that when i click next it would take the action before that, not the one I just clicked, and throw that as a param into the script. But ill try it now with the assumption that it passes what was literally just clicked into the script. Thank you.