cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Fields Helper V
Helper V

Button dissapearing after clicking on my own will

Hello,

 

I am trying to do a survey, and what i want was, after they click the start, the button would dissapear on their cellphone, so they won't take the servey again! The problem is i don't know the code, and also, i didn't want to subject them by giving their name since this is an anonymous survey!

 

 

Any help would be appreciated

 

Fields

3 ACCEPTED SOLUTIONS

Accepted Solutions
MelindaK Skilled Sharer
Skilled Sharer

Re: Button dissapearing after clicking on my own will

 

Oh yeah you are right, the button completely disappears, sorry I didn't test it properly yesterday.

However I do not know how to help you to make it completely disappears for a user, even when they open the app again. If I were to do it, I would implement some logic to keep track if the current user has submitted a survey (maybe give them random IDs or something).

 

Maybe someone else will be able to help you with that.

I will though explain how to make the button disappear for the current session, but bear in mind that the button will be visible again when they re-open the app (all the context variables values resetting).

 

Leave the 'Start' button OnSelect property as it used to be, without the UpdateContext, and modify the OnSelect property of the 'Submit' button. Since when that button is pressed it navigates back to the first page, I assume you have a Navigate function in it, so on that Navigate you need to modify it to pass a context variable back to the first screen:

Navigate(Screen1, ScreenTransition.Cover, {formSubmited: true})

- where formSubmitted is the context variable

 

Now on the first page on the 'Start' button Visible property use this:

If(formSubmited, false, true)

- which is going to hide the button when the formSubmitted is true, otherwise will show it

 

 

Maybe this will help you in another scenario, and I hope that someone else knows how to make the button completely disappear. I would be curious myself to find out how to do it 🙂 

 

Sorry I wan't of a more help.

 

Thanks,

MelindaK

View solution in original post

MelindaK Skilled Sharer
Skilled Sharer

Re: Button dissapearing after clicking on my own will

@Fields, I think I understand what you mean - when the person fills in the form the name will be saved automatically on the 'Created By' column, thus you can use this on the Visible property of the button:

 

IsEmpty(Filter(Test, Author.DisplayName = User().FullName).Author)

- this will hide the button if the user has already created an item in the list, or display it if the user didn't. 

You can use this directly on the button Visible property with no other variables. I have tested and it seems to be working for me.

However, it will not delegate for some reason (the blue indication appearing on the Author.DisplayName)

 

Hope this helps 🙂 

MelindaK

View solution in original post

MelindaK Skilled Sharer
Skilled Sharer

Re: Button dissapearing after clicking on my own will

@Fields

 

I have only created a test app and tested it myself, and then changed the formula to be something which would not validate like:

IsEmpty(Filter(Test, Author.DisplayName = "Test User").Author)

 then the button appeared.

 

I don't see how this could make the button unresponsive. This would only make the button visible, or hidden. 

I have added a text label which I have set to be visible when the button is pressed and it works for me. 

 

MelindaK

View solution in original post

22 REPLIES 22
MelindaK Skilled Sharer
Skilled Sharer

Re: Button dissapearing after clicking on my own will

Hi,

 

From your explanation I understand you want to hide a button after it has been clicked? 

For that you can use the Visible property with context variables.

 

On the OnSelect event of the button beside the function you already have, add UpdateContext({hideButton: true}) - hideButton being the context variable.

Then set the Visible property of the button to hideButton.

 

Or do you want the app to completely disappear from their phone once they have submitted an answer to the survey? If that's the case, then I don't know how to help you.

 

Hope this helps 🙂 

MelindaK
Fields Helper V
Helper V

Re: Button dissapearing after clicking on my own will

Hi @MelindaK,

 

I have tried to do what you said, but it did not work, please keep in mind that i am very new at the PowerApp, so problably i missed something here!

What i want to do is, they clicked the "Start" Button, they do the survey, and then, when they submit to go to the main menu, exactly the same expect the "Start" Button not showing, or atleast not fuctioning

If possible, the button gone missing forever, but i would be ok, if the button dissapear on that only usage

 

Awaiting Answer

 

EDIT: Hi, so i was able to make the change, but the button or completely dissapears, or doesn't do anything

Per example if i change hidebutton for HideButton2, it does nothing (Atleast on my own point of view as the owner), and if i but only button2 instead of HideButton, it will completely Dissapear (Like i said, only on my own point of view), is it normal? Or did i  did something wrong here?

 

Awaiting answer

MelindaK Skilled Sharer
Skilled Sharer

Re: Button dissapearing after clicking on my own will

 

Oh yeah you are right, the button completely disappears, sorry I didn't test it properly yesterday.

However I do not know how to help you to make it completely disappears for a user, even when they open the app again. If I were to do it, I would implement some logic to keep track if the current user has submitted a survey (maybe give them random IDs or something).

 

Maybe someone else will be able to help you with that.

I will though explain how to make the button disappear for the current session, but bear in mind that the button will be visible again when they re-open the app (all the context variables values resetting).

 

Leave the 'Start' button OnSelect property as it used to be, without the UpdateContext, and modify the OnSelect property of the 'Submit' button. Since when that button is pressed it navigates back to the first page, I assume you have a Navigate function in it, so on that Navigate you need to modify it to pass a context variable back to the first screen:

Navigate(Screen1, ScreenTransition.Cover, {formSubmited: true})

- where formSubmitted is the context variable

 

Now on the first page on the 'Start' button Visible property use this:

If(formSubmited, false, true)

- which is going to hide the button when the formSubmitted is true, otherwise will show it

 

 

Maybe this will help you in another scenario, and I hope that someone else knows how to make the button completely disappear. I would be curious myself to find out how to do it 🙂 

 

Sorry I wan't of a more help.

 

Thanks,

MelindaK

View solution in original post

Fields Helper V
Helper V

Re: Button dissapearing after clicking on my own will

Hey @MelindaK,

 

That Actually Works, Thank you very much, Altough isn't what i really wanted it, You actually led me a great step into it, and i thank you very much for it!

 

It works perfectly, there is nothing wrong with it!

 

Once again, I thank you very much

 

Fields,

Highlighted
MelindaK Skilled Sharer
Skilled Sharer

Re: Button dissapearing after clicking on my own will

I'm glad it helps 🙂
MelindaK
Fields Helper V
Helper V

Re: Button dissapearing after clicking on my own will

@MelindaK
Actually, i am  sorry for this :(, but the form doesn't submit now...

It goes directly to the mainscreen, but doesn't submit the form...

 

Fields

 

EDIT: Nevermind, it was my mistake! It's all good ^^

 

 

Fields Helper V
Helper V

Re: Button dissapearing after clicking on my own will

Hey @MelindaK,

 

Do you have any ideia on how to make a button completely dissapears... I have searching rough on this subject, and still can't find this...

 

Any response would be appreciated!

 

MelindaK Skilled Sharer
Skilled Sharer

Re: Button dissapearing after clicking on my own will

Hi @Fields,

 

Honestly I don't know how to completely make it disappear. From my experience, every time you open an app all variables get reset and I don't know a way to persist them.

The only workaround I could think of is to use some sort of identification (maybe under the form of ID) - assign an ID to a user and  when that user opens the app again check if a reply has already been submitted from that ID and show/hide the button. Not sure if that fits your case, but that's my only idea.

 

Maybe someone else will be able to help.

 

Thanks,

MelindaK
Fields Helper V
Helper V

Re: Button dissapearing after clicking on my own will

Hi @MelindaK,

 

That's basically the closes that i can get... And i would do that, but since this is "anonymous", i don't wanna go give them ID, so people know who is who, unless it's random, and i would got no ideia to indentifie who is who, then i would ask how do you do that!

Anyway, i your previous ideia still works perfectly so...

Helpful resources

Announcements
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

Top Solution Authors
Top Kudoed Authors
Users online (6,122)