Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. library(shiny)
  2. library(shinyjs)
  3.  
  4. ui<-shinyUI(
  5. fluidPage(
  6. useShinyjs(),
  7. tags$form(
  8. class = "form-horizontal", action="/action_page.php",
  9.  
  10. div(
  11. class = 'form-group',
  12. tags$label(class = 'control-label col-sm-2', `for` = 'month_abb', 'Month (abbr.)'),
  13. div(
  14. class = 'col-sm-4',
  15. selectInput('month_abb', '', month.abb)
  16. )
  17. ),
  18.  
  19. div(
  20. class = 'form-group',
  21. tags$label(class = 'control-label col-sm-2', `for` = 'month_full', 'Month (full)'),
  22. div(
  23. class = 'col-sm-4',
  24. selectInput('month_full', '', month.name)
  25. )
  26. ),
  27.  
  28. checkboxInput('abbr', 'Abbreviated')
  29.  
  30. )
  31. )
  32. )
  33.  
  34. server<-function(input, output) {
  35.  
  36. observe({
  37.  
  38. toggle(selector = "$('#month_full').parent('.form-group')", condition = !input$abbr)
  39.  
  40. toggle(selector = "$('#month_abbr').parent('.form-group')", condition = input$abbr)
  41.  
  42. })
  43.  
  44. }
  45.  
  46.  
  47. shinyApp(ui,server)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement