Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update feedback error #63

Closed
nara3m opened this issue Feb 28, 2022 · 1 comment
Closed

update feedback error #63

nara3m opened this issue Feb 28, 2022 · 1 comment
Assignees

Comments

@nara3m
Copy link

nara3m commented Feb 28, 2022

goal: depending on the input number (if else loop), different feedback message should be displayed. Possible duplicate of #55
error: after input change, feedback message is not updated
min working example to reproduce error: below.

library(shiny)
library(shinyFeedback)

# Module ui.R
expt.design.ui <- function(id) {
  ns <- NS(id)
  
  tagList(
    useShinyFeedback(),
    numericInput(ns("numSamples"), "How many samples in this experiment ?", value = 12)
  )
}

# Module server.R
expt.design.server <- function(input, output, session) {
  
  observeEvent(input$numSamples, {
    req(input$numSamples)
    if(is.numeric(input$numSamples)){
      if (input$numSamples > 100) {
        showFeedbackDanger(inputId = "numSamples", text = "too many..")
      } else if(input$numSamples <= 4) {
        showFeedbackWarning(inputId = "numSamples", text = "too less!")
      } else if(input$numSamples <= 100) {
        showFeedbackSuccess(inputId = "numSamples", text = "all good!")
      } else {
        hideFeedback("numSamples")
      }
    } else {
      showFeedbackDanger(inputId = "numSamples", text = "should be number!")
    }
    
  })
 
}


ui <- fluidPage(
  expt.design.ui(id = "numberFoo")
)

server <- function(input, output) {
  callModule(module = expt.design.server, id = "numberFoo")
}

shinyApp(ui, server)
> sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.6 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1

locale:
 [1] LC_CTYPE=en_US.UTF-8          LC_NUMERIC=C                 
 [3] LC_TIME=en_US.UTF-8           LC_COLLATE=en_US.UTF-8       
 [5] LC_MONETARY=en_US.UTF-8       LC_MESSAGES=en_US.UTF-8      
 [7] LC_PAPER=en_US.UTF-8          LC_NAME=en_US.UTF-8          
 [9] LC_ADDRESS=en_US.UTF-8        LC_TELEPHONE=en_US.UTF-8     
[11] LC_MEASUREMENT=en_US.UTF-8    LC_IDENTIFICATION=en_US.UTF-8

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods  
[8] base     

other attached packages:
 [1] shinyFeedback_0.4.0   svglite_2.1.0         metap_1.8            
 [4] cowplot_1.1.1         gridExtra_2.3         broom_0.7.12         
 [7] Cairo_1.5-14          DT_0.20               shinycssloaders_1.0.0
[10] ggalluvial_0.12.3     forcats_0.5.1         dplyr_1.0.8          
[13] purrr_0.3.4           readr_2.1.2           tidyr_1.2.0          
[16] tibble_3.1.6          tidyverse_1.3.1       shinydashboard_0.7.2 
[19] outliers_0.14         readxl_1.3.1          ggforce_0.3.3        
[22] Factoshiny_2.4        FactoInvestigate_1.7  FactoMineR_2.4       
[25] ggpubr_0.4.0          rstatix_0.7.0         ggpmisc_0.4.5        
[28] ggpp_0.4.3            reshape2_1.4.4        RColorBrewer_1.1-2   
[31] pheatmap_1.0.12       ggrepel_0.9.1         magrittr_2.0.2       
[34] stringr_1.4.0         qvalue_2.22.0         limma_3.46.0         
[37] xlsx_0.6.5            auth0_0.2.1           ggplot2_3.3.5        
[40] bs4Dash_2.0.3         shiny_1.7.1 `
@phoward38
Copy link
Collaborator

@nara3m This issue has been resolved in the most recent development version, which can be installed with remotes::install_github('merlinoa/shinyFeedback')

@phoward38 phoward38 self-assigned this Mar 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants