rstudio / shinyvalidate

Input validation package for the Shiny web framework
https://rstudio.github.io/shinyvalidate/
Other
110 stars 8 forks source link

check.required() not working with input_selectize #80

Closed sravanpannala closed 10 months ago

sravanpannala commented 10 months ago

I'm trying to use shiny-validate for python for checking if the user has selected exactly 5 choices in input_selectize. The documentation shows that with the current rules, this is not possible. Also, check.required() is not working with input_selectize at all. That is, no validation is occurring. Here is my cod

app_ui = ui.page_fluid(
    ui.input_selectize("players","Lineup (Select Exactly 5 players)",player_dict,multiple=True, width="70%")
)

def server(input, output, session):
    iv = InputValidator()
    iv.add_rule("players",check.required())
    iv.enable()

   @render.plot(alt="Stat Trends")
    def plot():
        req(iv.is_valid())
        fig, ax = plt.subplots(1,1
        return fig

The red text isn't showing under input_selectize and the plot is showing when it shouldn't