Forum

Thread tagged as: Problem, Forms, Members

Login error message not showing up

Hi! I will need a pair of eyes to check my members login form. The problem is that the error message for unknown credentials is not showing up when I try to login using random info.

This is my custom template:

<perch:form class="form__base" id="login_form" method="post" app="perch_members" novalidate="novalidate" data-init="form">
    <fieldset class="form__wrapper">
        <legend class="is-visually-hidden">Log in</legend>
        <div class="form__error">
            <perch:error for="all" type="login">
                <p class="form__error">¡No encontramos un usuario con estos credenciales!</p>
            </perch:error>
        </div>
        <div class="form__section form__section--required">
            <perch:label for="email" class="form__label">Email</perch:label>
            <perch:input type="email" id="email" label="Email" class="form__input form__input--email" disabled="disabled"/>
            <span class="form__emptyerrormessage">Este campo no puede estar vacío</span>
            <span class="form__invaliderrormessage">Por favor comprueba el email, parece incorrecto</span>
        </div>
        <div class="form__section form__section--required">
            <perch:label for="password" class="form__label">Contraseña</perch:label>
            <perch:input type="password" id="password" label="Password" class="form__input form__input--password" disabled="disabled"/>
            <span class="form__emptyerrormessage">Este campo no puede estar vacío</span>
        </div>
        <div class="form__section form__section--submit">
            <perch:input type="submit" id="submit" value="Log in" class="form__button" disabled="disabled" />
            <perch:input type="hidden" id="r" />
        </div>
        <div class="form__section">
            <p>¿has olvidado tu contraseña? <a href="/members/reset.php">Crea una nueva</a>.</p>
        </div>
    </fieldset>
</perch:form>

I have removed all the perch error messages except the top one about the unknown credentials. However this doesn't look to be related.

When I replace this with the default template, the error message appears. Could you please help?

Proko Mountrichas

Proko Mountrichas 3 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

What's the difference between the form that works and the one that doesn't?

Went over all the differences again and at the end what was causing the problem was the id="login_form" on the <perch:form>. It was the only thing I didn't think to test yesterday. If I use id="login" it works. For a moment I thought that the id of the form has to be the same as the type in the <perch:error>. However

<perch:error for="all" type="login_form">

didn't work. Which means that the login form only works if the id is id="login". Is that correct?

Drew McLellan

Drew McLellan 2638 points
Perch Support

If a form has a specific purpose defined by an app, then you need to use the ID the app is watching for.