Back button after form submit


#1

what can you do about the back button after a form submit?

if the user clicks back, then they will go back to the form and they can submit again?
should i just clear the entire history?
can i allow the user to go back to the history before the form submit?


#2

I use same view for form submit, so when user submit the form, they stay in the same state

Here’s my sample code

<ion-view title="{{ 'loan' | translate }} - {{ 'loan_check_debt' | translate }}">

    <ion-content has-header="true" padding="true">

        <div ng-show=" ! result">
            <form>
                <div class="list">
                    <label class="item item-input">
                        <span class="input-label">No Rekening</span>
                        <input type="number" ng-model="data.rekening">
                    </label>
                    <label class="item item-input">
                        <span class="input-label">PIN AO</span>
                        <input type="password" ng-model="data.pin">
                    </label>
                </div>
                <div class="padding">
                    <button class="button button-block button-positive" ng-click="submit(data)">
                        Submit
                    </button>
                </div>
            </form>
        </div>

        <div ng-show="result">
            <button class="button button-block button-assertive" ng-click="showForm()">
                Tampilkan Form
            </button>

            <div class="list">
                <div class="item">
                    <h2>No Rekening</h2>
                    <p>{{ result.rekening }}</p>
                </div>
                <div class="item">
                    <h2>Nama Debitur</h2>
                    <p>{{ result.nama }}</p>
                </div>
                <div class="item">
                    <h2>Plafond</h2>
                    <p>Rp{{ result.plafondFormatted }},00</p>
                </div>
                <div class="item">
                    <h2>Baki Debet</h2>
                    <p>Rp{{ result.bakiDebetFormatted }},00</p>
                </div>
                <div class="item">
                    <h2>Requested At</h2>
                    <p>{{ result.requestedAt.date }}</p>
                </div>
            </div>

            <button class="button button-block button-balanced" ng-click="print()">
                Print
            </button>
        </div>

    </ion-content>

</ion-view>

Form hidden or show by trigger ng-show :slight_smile: