emvecchi commited on
Commit
49ed3f2
·
verified ·
1 Parent(s): 46c2410

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -13
app.py CHANGED
@@ -939,9 +939,18 @@ elif st.session_state.current_index < len(st.session_state.data):
939
  show_fields(STEPS[step])
940
 
941
  # Action buttons
942
- c1, c2, c3 = st.columns([1,1,6])
943
  with c1:
944
- label = "Next" if step < total_steps - 1 else "Submit & next session"
 
 
 
 
 
 
 
 
 
945
  if st.button(label):
946
  if validate_current_page(STEPS[step], st.session_state.current_index):
947
  is_last_page = (step == total_steps - 1)
@@ -959,19 +968,19 @@ elif st.session_state.current_index < len(st.session_state.data):
959
 
960
  elif st.session_state.current_index == len(st.session_state.data):
961
  st.write(f"**Thank you for taking part in this study!** \n ")
962
- if st.button("Previous"):
963
- navigate(-2)
964
 
965
  # Navigation buttons
966
- if 0 < st.session_state.current_index < len(st.session_state.data):
967
- if st.button("Previous"):
968
- if step > 0:
969
- st.session_state.step -= 1
970
- st.rerun()
971
- else:
972
- st.session_state.current_index -= 1
973
- st.session_state.step = total_steps - 1
974
- st.rerun()
975
 
976
  if 0 <= st.session_state.current_index < len(st.session_state.data):
977
  st.write(f"Session {st.session_state.current_index + 1} out of {len(st.session_state.data)}")
 
939
  show_fields(STEPS[step])
940
 
941
  # Action buttons
942
+ c1, c2, c3 = st.columns([3,5,2])
943
  with c1:
944
+ if st.button("Previous"):
945
+ if step > 0:
946
+ st.session_state.step -= 1
947
+ st.rerun()
948
+ else:
949
+ st.session_state.current_index -= 1
950
+ st.session_state.step = total_steps - 1
951
+ st.rerun()
952
+ with c2:
953
+ label = "**Next**" if step < total_steps - 1 else "**Submit & next session**"
954
  if st.button(label):
955
  if validate_current_page(STEPS[step], st.session_state.current_index):
956
  is_last_page = (step == total_steps - 1)
 
968
 
969
  elif st.session_state.current_index == len(st.session_state.data):
970
  st.write(f"**Thank you for taking part in this study!** \n ")
971
+ # if st.button("Previous"):
972
+ # navigate(-2)
973
 
974
  # Navigation buttons
975
+ #if 0 < st.session_state.current_index < len(st.session_state.data):
976
+ # if st.button("Previous"):
977
+ # if step > 0:
978
+ # st.session_state.step -= 1
979
+ # st.rerun()
980
+ # else:
981
+ # st.session_state.current_index -= 1
982
+ # st.session_state.step = total_steps - 1
983
+ # st.rerun()
984
 
985
  if 0 <= st.session_state.current_index < len(st.session_state.data):
986
  st.write(f"Session {st.session_state.current_index + 1} out of {len(st.session_state.data)}")