Forum

Thread tagged as: Problem, Error, Shop

Form button text unsettable

I have the following line in the order_address_form template.

No matter how I change it, the text 'Login' is displayed.

Before I changed the value from 'Ok!' it was showing 'Ok!'.

        <perch:input type="submit" id="submit" value="Ok!" />
Fred Stidston

Fred Stidston 0 points

  • 1 month ago
Drew McLellan

Drew McLellan 2517 points
Perch Support

Where's the "Login" coming from?

Yes thats a total mystery to me.

Drew McLellan

Drew McLellan 2517 points
Perch Support

Did you build the site? What context is this button appearing in?

Hello Fred,

Could you share your code with us?

Yes I am building the site. The button is on the checkout page.

The page code is as follows

<?php include('perch/runtime.php'); ?>
<?php
PerchUtil::hold_redirects();
if (perch_member_logged_in() && perch_shop_addresses_set()) {
    perch_shop_checkout('paypal-express', [
        'return_url' => 'http://localhost:8888/zoeseddon/result.php',
        'cancel_url' => 'http://localhost:8888/zoeseddon/cancel.php'
    ]);
}
    // if ( perch_post('stripeToken')) {
    //  perch_shop_checkout('stripe', [
    //      'return_url' => './success.php',
    //      'cancel_url' => './fail.php',
    //      'token'      => perch_post('stripeToken')
    //    ]);
    // }
?>
<!doctype html>
<html>
    <head>
        <?php perch_layout('global.head'); ?>
    </head>
    <body id="checkout">
        <?php
            perch_layout('global.header', array(
                'title'=> perch_content('Site Title',true),
                'image'=> perch_content('Logo',true)
            ));
        ?>
        <main>  
            <div class="heading">
                <div class="container">
                <h3>Checkout</h3>
                </div>
            </div>
            <div class="container">
                <div class='columns'>
            <?php
                if (perch_member_logged_in()) {
                    perch_shop_order_address_form();
                    echo "<div class='col-2'>";
                    echo "<p><a href='logout.php' class='button'>Log out</a></p>";
                    echo "<p><a href='addresses.php' class='button'>Manage addresses</a></p>";
                    echo "</div>";
                } else {
                    perch_shop_login_form();
                    perch_shop_registration_form();
                }

            ?>
                </div>
            </div>

            <style>
fieldset {
    border: none;
}
label {
    display: block;
}
input {
        max-width: 100%;
    display: inline-block;
}
input[type="text"],
input[type="email"],
input[type="password"] {
    color: #79aaaa;
    padding: 20px;
    font-size: 16px;
    border: 1px solid #2d8898;
}
input[type="submit"] {
    color: white;
    padding: 20px;
    font-size: 16px;
    border-radius: 0;
    background-color: #68e3e0;
    border: 0;
}

input[type="submit"]:hover {
    background-color: #61cac8;
}
select {
    width: 100%;
    display: inline-block;
    margin: 0;
}
</style>
        </main>
        <?php
            perch_layout('global.footer');
        ?>
            <?php perch_get_javascript(); ?>

    </body>
</html>
    <?php PerchUtil::output_debug(); ?>

The template code is as follows

<perch:form id="order_address" method="post" app="perch_shop">
    <h2>Addresses</h2>
    <h4>Shipping address</h4>

    <perch:addresses>
        <div>
            <label>
                <perch:input type="radio" id="shipping" value="<perch:address id="addressSlug" />" />
                <perch:address id="addressFirstName" /> <perch:address id="addressLastName" /> <perch:address id="addressCompany" /><br />
                <perch:address id="address_1" /> <perch:address id="address_2" /><br />
                <perch:address id="city" /> <perch:address id="county" /> <perch:address id="postcode" /> <perch:address id="country_name" />
                <span class="radio"></span>
            </label>
        </div>
    </perch:addresses>


    <h4>Billing address</h4>

    <perch:addresses>
        <div>
            <label>
                <perch:input type="radio" id="billing" value="<perch:address id="addressSlug" />" />
                <perch:address id="addressFirstName" /> <perch:address id="addressLastName" /> <perch:address id="addressCompany" /><br />
                <perch:address id="address_1" /> <perch:address id="address_2" /><br />
                <perch:address id="city" /> <perch:address id="county" /> <perch:address id="postcode" /> <perch:address id="country_name" />
                <span class="radio"></span>
            </label>
        </div>
    </perch:addresses>


    <div>
        <perch:input type="submit" id="submit" value="Pay by card" />
        <perch:input type="hidden" id="r" />
    </div>

</perch:form>

The issue was resolved by waiting some time

The issue was resolved by waiting some time

If you set PERCH_PRODUCTION_MODE to PERCH_DEVELOPMENT in your config, template changes should be applied immediately.

define('PERCH_PRODUCTION_MODE', 'PERCH_DEVELOPMENT');
Drew McLellan

Drew McLellan 2517 points
Perch Support

Actually:

define('PERCH_PRODUCTION_MODE', PERCH_DEVELOPMENT);

My whole life has been a lie!!!!!