1

I have a form that has action attribute to the same page. On submitting the form, the same page is reloaded with page content changed based on the value submitted.

But when I refresh the page, Continue Form Submission page is popped up.

How do I disable it?

Here's my HTML form:

     <form method="post">
      <div class="form-group">
        <label for="year" class="col-sm-2 control-label">Select Year:</label>
        <div class="col-sm-3">
            <select class="form-control" id="year" name="year">
            </select>
        </div> 
        <div class="col-sm-2">
            <button class="btn btn-primary" type="submit" name="date">Done</button>
        </div>

      </div>
    </form>

Values in select element is populated with JavaScript:

<script type = "text/javascript">
var min = 2014,
max = new Date().getFullYear(),
holiday_dropdown = document.getElementById('year');

// var theMonth = new Date().getMonth();

for (var i = max; i >= min; i--)
{
    var opt = document.createElement('option');
    opt.value = i;
    opt.innerHTML = i;
    holiday_dropdown.appendChild(opt);
}
</script>

Route of this page is given as:

$f3->route('GET|POST /leave/report', 'GBD\Internals\Controllers\LeaveController->leaveReportGenerator');

How can I disable this dialog from occuring? Any help is very much appreciated. Thanks.

Azima
  • 3,835
  • 15
  • 49
  • 95
  • 2
    Please refer this answer: https://stackoverflow.com/questions/6833914/how-to-prevent-the-confirm-form-resubmission-dialog – beingadityak Dec 12 '17 at 08:46
  • 1
    you need to use `$f3->reroute('/leave/report')` to reroute back to the GET page after the POST was processed. – ikkez Dec 13 '17 at 20:00

0 Answers0