EEConf 2024 is around the corner! EEConf 2024
Is this possible any longer? I have a client who’s trying to do this using the syntax from the EE2 days (after upgrading their site to 6.2.7) but it’s not working and renders the show_error()
view.
The tag they’re using is
{exp:member:login_form
return="registration/{embed:url_title}"
form_id="login-form"
error_handling="inline"
error_delimiters='fdsa'
}
Which I’m told used to work.
I did some digging and found this: EE6:// Member Management inline error handling not working
But there’s no resolution or answer.
And this, which says it’s been resolved: error_handling = inline tag not working for login form #705
So I’m thinking there’s something I’m missing. But even checking the code, it really does look like it’s not possible. But I’m hoping I’m missing something.
Any ideas?
You can pass your own validation class, which is what I did for the login. There is a parameter for this called “form_class=”
Strangely, it does not work for other EE forms, but it does for the login form. That way, you can build your own inline validation on pages. I actually prefer this method, EE passing its own classes creates all sort of mess on templates. An example of this is the channel forms, on the latest version they to inject their own classes and I had to remove that code because it was messing my page design.
Yeah, that’s sorta my suggestion to the client; I can create a custom Ajax endpoint they can use to verify the credential pair before submitting the form. But, that’s hardly “good” IMO and completely bypasses the template tag.
I don’t know; I was really hoping there was a way to do inline error messages on the login form in 2022. FWIW, it’s not that the client wants to display “required” per field but that they want to avoid the default EE error template and keep the user on the login form. For example, displaying ‘user not found’ inline with the username field.
That’s not possible? Am I implementing this weird and there’s an “official” way to do this?
Correct, in my case I just made some custom validators that do check for content as well, not just missing, example, if something is an email, or numbers, or max characters, etc.
You can do all that with your own validations. Granted, it bypasses the EE field validation, but that would still be triggered on the server side validation if for example someone submits the form or disables your validation on purpose (like disabling JavaScript).
I found out it’s a good compromise, the validation is on the user side for a better GUI experience, but EE will still make its own server validation (which is the real security one). Most users will never see the EE one unless they are messing up with something in the source code. Ideally you could use the EE validation and just pass the results to your template with CSS or Ajax, but in my experience this does not work very nicely with your own design either as everyone might use a different style or framework. Might work for basic designs or simple sites.
This also did not play right when you have multiple languages, as you get a generic text. In my experience, I was just better off not using the EE validation for the user front end, since it is not flexible enough at this point for my needs.
The member parameters are mostly new and still missing features, while the login one comes from older versions, reason why it probably had that inline methods you mentioned, other member forms for example don’t even support the class parameter to name one. I wrap them in another form or div to apply my style class to those forms, as discovered recently. I suspect this stuff will be improved in further releases, and maybe inline EE validation can be used again for most forms or consumed to a template in a better way.
For the login, validation should be quite simple as you are just checking mainly one field (username). You should not validate the password since it’s very complex, and you have no idea what characters someone might use. Passwords are usually not validated on the user front. It’s mainly the username only, and if it’s an email, there is HTML 5 build in email field for that, most validators will have at least email, numbers, etc. If it’s something else, like a number, again very simple to validate.
I see. Bummer. Still, thank you SO very much for the detailed explanation. For real. You could have come in with “No, you can’t do that” and called it a day. The follow through made this make a ton of sense and really understand why it is that way. For real; I appreciate the effort.
So, for now, anyone who comes by this in the future, the answer’s:
No, you can’t do that as of 6.2.7.
I’ve put a little Action method together for this particular client; thought I’d share for anyone else who could use:
public function member_login_ajax_validate()
{
ee()->load->library('Auth');
$verify = ee()->auth->verify();
$reasons = [];
if(!$verify) {
$reasons = ee()->auth->errors;
}
$email = '';
echo json_encode([
'result' => ($verify ? 'success' : 'fail'),
'reason' => $reasons,
'username' => ee()->input->get('username'),
]);
}
Here’s a comprehensive response addressing the inline error handling issue in ExpressionEngine 6 for login forms:
Understanding the Issue:
error_handling="inline"
parameter for {exp:member:login_form}
is not functional in EE6.Available Solutions:
JavaScript-based Error Handling:
$('#login-form').submit(function(e) {
// Validate fields here
if (/* invalid fields */) {
e.preventDefault(); // Prevent form submission
// Display inline errors using jQuery
}
});
Third-Party Add-Ons:
Template Modifications:
error:username
) and display errors accordingly.Custom Solutions:
Additional Considerations:
I hope this comprehensive response addresses the infinite craft issue and provides helpful options!
Complete and utter success! Among the various papers on the issue, this one is possibly the most compelling. Very impressive information! Given my significant experience in this industry, I fully understand the level of effort you are putting in. I sincerely appreciate the outstanding service you have offered. papa’s freezeria
The username is the main focus, and if it’s an email, there is a built-in email field in HTML 5 for that. Most validators will include email, numbers, and other types of validation. If it’s a different type head soccer of input, such as a number, it’s also very simple to validate.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.