make field mandatory

201 views
Skip to first unread message

Koushik Saha

unread,
Jan 17, 2014, 7:43:25 AM1/17/14
to shiny-...@googlegroups.com
fi folks

here it goes.. how to force an user for an mandatory input  field in the case of select input, radiobuttons and checkboxinput in shiny.
if anybody has any solution can u please point me to that direction.
one way might be if the id variable for that selected input is NULL . any other workaround for the same? may be some build-in feature.


one more how can we change the height and width for an selecInput when multiple=TRUE. sometimes the box is getting very dirty to see.


Regards
Koushik Saha


Patrick Toche

unread,
Jan 17, 2014, 10:29:41 AM1/17/14
to shiny-...@googlegroups.com
I'm not sure I fully understand your first question. You know you can hide things in a conditionalPanel and force users to click or fill in something in order to reveal the panel, that's one way to make some action "compulsory".

on your second question, see this:


one thing I do now is to customize the style on the id of the object. To see what I mean, look at:


in particular "#mainPanelId and "#sidebarPanelId

you should be able to apply the same technique. You don't have to put the styles in global.R as I did, you can put them in the body of your ui.R or you can have them in a css file with includeCSS:

KOUSHIK SAHA

unread,
Jan 17, 2014, 11:03:59 AM1/17/14
to Patrick Toche, shiny-...@googlegroups.com
I mean to say, lets say I have two selectinput box in my ui.R . Now it is upto the user to use the the selectinputs buttons to change the result output.  I want to make sure that the user is making a choice in the selectinput box I.e. to make the fields mandatory input fields.

It is more liking that the red color  star mark beside the input box of a user.  And if the user is not filling that inputbox some warning is thrown.

Regards
Koushik Saha

From: Patrick Toche
Sent: ‎17-‎01-‎2014 08:59 PM
To: shiny-...@googlegroups.com
Subject: Re: make field mandatory

--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

ZJ

unread,
Jan 17, 2014, 2:50:16 PM1/17/14
to shiny-...@googlegroups.com, Patrick Toche
I can think of this way. Maybe something like

if (is.null(input$required)) {
  showshinyalert( etc etc )
  return(NULL)
}

by using the shinyalert functions in the shinysky package? https://github.com/AnalytixWare/ShinySky
Reply all
Reply to author
Forward
0 new messages