inst/hbcdtlfb/www/R/observe/show_all_substances.R

if(input$all_substances) {
  
  updateVirtualSelect(
    session = session, 
    "substance_routine", 
    "Substance:",
    choices = substances |> 
      prepare_choices(name_short_html, name_short_html, group), 
    selected = "")
  
  updateVirtualSelect(
    session = session, 
    "substance_P1", 
    "Substance:",
    choices = substances |> 
      prepare_choices(name_short_html, name_short_html, group), 
    selected = "")
  
  updateVirtualSelect(
    session = session, 
    "substance_P2", 
    "Substance:",
    choices = substances |> 
      prepare_choices(name_short_html, name_short_html, group), 
    selected = "")
  
  updateVirtualSelect(
    session = session, 
    "substance_P3", 
    "Substance:",
    choices = substances |> 
      prepare_choices(name_short_html, name_short_html, group), 
    selected = "")
  
  updateVirtualSelect(
    session = session, 
    "substance_P4", 
    "Substance:",
    choices = substances |> 
      prepare_choices(name_short_html, name_short_html, group), 
    selected = "")
  
  updateVirtualSelect(
    session = session, 
    "edit_routine_substance", 
    "Substance:",
    choices = substances |> 
      prepare_choices(name_short_html, name_short_html, group), 
    selected = "")
  
  updateVirtualSelect(
    session = session, 
    "edit_substance", 
    "Substance:",
    choices = substances |> 
      prepare_choices(name_short_html, name_short_html, group), 
    selected = "")
  
}

if(! input$all_substances) {

updateVirtualSelect(
  session = session, 
  "substance_routine", 
  "Substance:",
  choices = substances_names_grouped(), 
  selected = "")

updateVirtualSelect(
  session = session, 
  "substance_P1", 
  "Substance:",
  choices = substances_names_grouped(), 
  selected = "")

updateVirtualSelect(
  session = session, 
  "substance_P2", 
  "Substance:",
  choices = substances_names_grouped(), 
  selected = "")

updateVirtualSelect(
  session = session, 
  "substance_P3", 
  "Substance:",
  choices = substances_names_grouped(), 
  selected = "")

updateVirtualSelect(
  session = session, 
  "substance_P4", 
  "Substance:",
  choices = substances_names_grouped(), 
  selected = "")

updateVirtualSelect(
  session = session, 
  "edit_routine_substance", 
  "Substance:",
  choices = substances_names_grouped(), 
  selected = "")

updateVirtualSelect(
  session = session, 
  "edit_substance", 
  "Substance:",
  choices = substances_names_grouped(), 
  selected = "")

}
ucsd-dsm/hbcd-tlfb documentation built on July 10, 2022, 5:46 p.m.