1

I have to keep the quick login form in the header whilst on the proper login page.

This means that if you submit either form with an error, it shows the error messages in the header and in the main content area.

Is there any way to prefix the tags?

{header:field:email} and {content:field:email} for example?

1

There's no way to prefix the tags - form errors will be displayed anywhere on the page a Freemember login form appears.

In general the accepted design is not to show error messages in the header since there isn't much space anyway - simply redirect to a /login page which has the full error messages displayed inline.

If you want to display errors in the header, then you will just need to live with them being displayed in multiple places.

3
  • Wouldn't freemember be able to handle this somehow with exposing / handling the form_id= parameter and/or some javascript? – GDmac Mar 28 '14 at 9:00
  • It could probably be handled using the form_id parameter, by submitting it then only displaying errors where the form_id matches. That's not the way it works currently though (happy to take a look at a pull request on github if someone wants to add this feature). – Adrian Macneil Mar 28 '14 at 14:24
  • Hmm, "only displaying errors where the form_id matches". Because freemember fetches the params from _POST, This can be done with css only (see my answer) – GDmac Mar 29 '14 at 8:13
2

If you set different form_id on the forms and set different css classes on your error delimiters,
then you will be able to use CSS to hide the errors in the other form.

{exp:freemember:login form_id="form1" ... error_delimiters='<span class="error_1">|</span>'}
    ...
{/exp:freemember:login}

{exp:freemember:login form_id="form2" ... error_delimiters='<span class="error_2">|</span>'}
    ...
{/exp:freemember:login}

// css
#form1 .error_2, #form2 .error_1 { display:none; }
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.