• 13
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

I am navigating to other page after button onClick(). I want to avoid situation with double click. Now when I click button more than once, for example twice, before the next page is shown with the result, there are multiple instances of the next page created.

private async void Button_Clicked(object sender, EventArgs e)
{
    var newPage = new NewPage();
    await Navigation.PushAsync(newPage);
}

What should i need to be added in my code?

You could judge istapped when button is tapped like following code.

var _istapped = false;

private async void Button_Clicked(object sender, EventArgs e)
{
    if(_istapped)
        return;

    _istapped = true;

    var newPage = new NewPage();
    await Navigation.PushAsync(newPage);

    _istapped = false;
}
  • 1
Reply Report