# I want to have onBackButton only on that page

**URL:** <https://forums.fusetools.com/t/i-want-to-have-onbackbutton-only-on-that-page/535>\
**Category:** How-to Discussions\
**Created:** [August 5, 2017, 6:19am UTC](https://forums.fusetools.com/t/i-want-to-have-onbackbutton-only-on-that-page/535 "2017-08-05T06:19:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![operate2v](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/operate2v/32/627_2.png) [@operate2v](https://forums.fusetools.com/u/operate2v)\
**Post date:** [August 5, 2017, 6:19am UTC](https://forums.fusetools.com/t/i-want-to-have-onbackbutton-only-on-that-page/535/1 "2017-08-05T06:19:21Z")

</div>

Hello!  
I want to have the app exit when I touch the backButton. To do this, I created a Panel that asks if I really want to quit the app when I touch the backButton.

However, if you touch the backButton to go to the page to terminate the app from another page, it runs from the page to the end to the panel asking to end.

I want the panel asking for exit to be run via the backbutton only on the page for termination. Help me!!

MainView

```auto
<App>
  <HomeScreen ux:Global="HomeScreen"/>
  <Router ux:Name="router"/>
  <JavaScript> ... </JavaScript> <!-- router func -->

  <Panel Width="100%" Height="100%">
      <Navigator DefaultPath="tpStartPage">
          <StartPage ux:Template="tpStartPage" router="router"/>
          <EndPage ux:Template="tpEndPage" router="router"/>
      </Navigator>
  </Panel>
</App>

```

StartPage

```auto
<Page ux:Class="StartPage">
    <Router ux:Dependency="router" /><!-- router func -->
    <JavaScript>...</JavaScript>

    <DockPanel>
        <Panel ux:Name="panels" Width="50" Height="50" Color="#aaaaaa" Alignment="Top"/>
        <Rectangle ux:Name="finishRect" Color="#0003" Opacity="2" Visibility="Collapsed" ZOffset="0.9"/>
        <FinishPanel ux:Name="chekc" finishRect="finishRect" ZOffset="1"/>

        <Panel ux:Name="test" Width="50" Height="50" Color="#ed9d9d" Alignment="Bottom" Clicked="{puchPages}"/>
    </DockPanel>
    <Panel Width="40" Height="40" Color="#662626" Margin="0,0,0,30" ux:Name="adad">
        <Clicked>
          <Set panels.Color="#9ccb6d"/>
          <Set chekc.Visibility="Visible"/>
          <Set finishRect.Visibility="Visible"/>
        </Clicked>
    </Panel>
    <OnBackButton>
        <Set panels.Color="#9ccb6d"/>
        <Set chekc.Visibility="Visible"/>
    </OnBackButton>
</Page>

```

EndPage

```auto
<Page ux:Class="EndPage">
    <Router ux:Dependency="router" />

    <JavaScript>...</JavaScript>

    <Panel>
      <Button Text="Back!" Alignment="Center" Clicked="{gobackPage}"/>
    </Panel>
</Page>

```

---

<div class="post-metadata">

**Author:** ![Uldis](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/uldis/32/657_2.png) [@Uldis](https://forums.fusetools.com/u/Uldis)\
**Post date:** [August 7, 2017, 8:32am UTC](https://forums.fusetools.com/t/i-want-to-have-onbackbutton-only-on-that-page/535/2 "2017-08-07T08:32:25Z")

</div>

You could wrap the `OnBackButton` inside of a `WhileActive` on that page you want it on. Then it’ll only be executed when that page is active:

```auto
<WhileActive>
    <OnBackButton>
        <Set panels.Color="#9ccb6d"/>
        <Set chekc.Visibility="Visible"/>
    </OnBackButton>
</WhileActive>

```
