hello guys my name is khan and actually in this video mainly we will be discussing a function in shiny which is action button action button is very much similar to submit button but there are some very significant difference between action button and submit button so before going forward you guys may have remembered that i have made a video about submit button before so before going towards the action button i will just uh discuss in quickly about the submit button and so this is the file that we have created in our previous video which was related to submit button and i will just open it up for you guys then and i will just execute it first and then i will discuss ctrl a ctrl enter you guys may have remembered that we have created this submit button so what this submit button was doing that it was controlling the reactivity of our dashboard so suppose if we haven't used this submit button so whatever we have written down here this is a text inbox and i'm writing and i'm calling that text input output in my main panel but suppose if i write down the college name lse it's not written down here until i click this button update now and it's written down here in the same way what is your degree level for degree level is 18 and update now so degree level is written down here and and if again my graph is also linked with this down select input button so i will select new york my graph will be updated here now you can see the x is representing new york and again this
a radio button is also linked with this update button so all your input buttons are linked controlled by this update if you will not click this update your changes will not adjust in the main panel according to your
according to your input buttons which are in your sidebar panel but suppose you want to control the control whatever is appearing so suppose if you want to control the reactivity selectively so what does it mean suppose I want that whatever I make changes in supposing it is in a college name it keeps on changing my main panel keep on changing instantly but I don't want to update my degree level until I select some button or until I want to change it accordingly so in that case when you want this selective control reactivity then we usually use action button uh in so now what I will do I will go back to my code and so this is the core for which we have used for submit button but now I will create a new code but I will be using the same code but I will adjust it for the action button so I will close it doesn't say so I will just copy the same code that we have used for submit button and I will edit it a bit so that uh I will be using action button in that code
so this is the code which we have for which was actually we built for submit button so now what i want is because i don't want submit button now i want action button uh so i will quickly go through the code we have these libraries i will be using this is my working directory and then within my working directory we i'm using this shiny ui assigning it to an object calling it as ui titling it as my password dashboard app and then i want my sidebar layout to here on the right hand side my sidebar panel have the following i have text inputs where i'm saying what is your college name the id will be name what is your degree level is have a tax input id level whereas the what is your in which city do you live so there are three options london new york paris and these options will be get saved into an id city input id cd and might have a radio button that what is your medical status or single these values will be stored in input id marital and after that and i want to show some outputs in my output panel uh so now the thing is that okay i don't want this red submit button so i will just remove it from here and what i will do now i will add suppose if i want to add my action button in my main panel so in order to do that i think i'll just execute these libraries
control enter and now I will start writing my action button because initially, I want my action button to be showing shown under the main panel and within the action button first what will be my input id so my input id that I want to have supposed uh
input id is okay click so you can name it whatever you want I am just naming this click and
I will be labeling my action button as the next option I have to tell is the label so let's see my label is
do selective
update so actually I've just have added this action button I haven't linked this action button with anything, ACTION uh so there is some error happening related to brackets
#ACTION #BUTTON #RSHINY #CONTROLLED #REACTIVITY
R Shiny Playlist: • Learn Building R Shiny Dashboard with Us