Making shinyCaptcha and conditionalPanel work together

39 views
Skip to first unread message

nirzaree vadgama

unread,
Mar 1, 2022, 11:52:01 AM3/1/22
to shiny-...@googlegroups.com
Hello all,

Has anyone tried recaptcha https://github.com/carlganz/shinyCAPTCHA in their shiny apps along with conditionalPanel and got it working?

Due to some logic in the ui in shinyCaptcha, I am unable to get conditionalPanel working along with it in my sidebarPanel.

Without shinyCaptcha, conditionalPanel works.

CondPanelwoutRecaptcha.gif
However when I add recaptcha, conditionalpanel logic does not work
CondPanelwRecaptcha.gif
This is my code:  (you will need to generate and enter a sitekey to run this :| )

    # setup -------------------------------------------------------------------
    library(shiny)
    library(shinyjs)
    library(leaflet)
    library(data.table)
    library(shinyCAPTCHA)
   
   
   
    # Define UI for application
   
    ui <- fluidPage(
        div(h1("Application Title"),
            h3("Application description"),align = "center"),
   
        # Sidebar with a slider input for number of bins
        sidebarLayout(
            sidebarPanel(
                # div(
                h4("Register/Request for a new site"),
                shinyjs::useShinyjs(),
                radioButtons("registerorrequest",
                             "Register or Request: ",
                             choiceValues = list("register","request"),
                             choiceNames = c(
                                 "Register your entity",
                                 "Request for an entity"
                             ),
                             selected = NULL),
               
                conditionalPanel(
                    condition = "input.registerorrequest == 'register'",
                    numericInput("A","Input A for register",value = 0),
                    radioButtons("B","Input B for register: ",
                                 choices = c(
                                     "X",
                                     "Y",
                                     "Z",
                                     "Other"
                                 ),selected = NULL),
                    radioButtons("C", "Input C for register: ",
                                 choices = c(
                                     "more choices",
                                     "other choices"),selected = NULL),
                    radioButtons("D","Input D for register:",
                                 choices = c("Yes","No"),selected = NULL)
                ),
                conditionalPanel(
                    condition = "input.registerorrequest == 'request'",
                    radioButtons("P", "Input P for request: ",
                                 choices = c(
                                     "some choices",
                                     "some more choices"),selected = NULL),
                ),
                div(textInput("additionalinput","Any additional input",value = ""),
                    recaptchaUI("test", sitekey = "enterSitekey"),
                    uiOutput("humansOnly"),
                    style = "font-family:Arial"),
                width = 4
            ),
           
            # Show a plot of the generated distribution
            mainPanel()))
   
        # Define server logic
        server <- function(input, output) {}
       
        # Run the application
        shinyApp(ui = ui, server = server)

Any help to solve this would be wonderful.

Thanks!

Best,
Nirzaree
Reply all
Reply to author
Forward
0 new messages