3

I have absolutely zero experience with Expression Engine but I've been given a task to fix a validation on a registration form. There's a username field that is supposed to validate as email address only but right now it accepts any string. I have no idea if that registration is a plugin or built in. I found it's template in /themes/forum_themes/site/forum_member

I suspect I need to find a model for the registration db table now and change the validation type from string to email? Or something like that? I have basically no idea where to start without getting to know EE from scratch.

Any help apprieciated. Thanks

3

That's the native EE forum template.

I suggest using the jQuery Validation plugin http://jqueryvalidation.org/. You can add the code to the forum header template. I don't know the header template name offhand but it should be in the same directory.

<form id="registration" action="">
    <input id="email" type="email" name="email" required>
    <input type="submit" value="Submit">
</form>
<script>
    $("#registration").validate({
        rules: {
            email: {
                required: true,
                email: true
            }
        },
        messages: {
            email: {
                required: "Please enter a valid email address"
            }
        },
    });
</script>
| improve this answer | |
  • 1
    But it already has a server-side validation applied. I don't want to change it to something new. From experience with other CMSs and frameworks I know it should be possible to just change validation type for this field to 'email'. Can this be done at all? – belinea Dec 4 '13 at 17:32
  • 1
    I'm pretty sure you're going to have to use client-side validation for this but I'll let others respond. Someone else may know a way to do it without hacking core code. – Anna_MediaGirl Dec 4 '13 at 17:42
  • Ok, thanks for help. Yeah, looks like it may be the best way to go. Certainly faster as it wouldn't require me learning EE :) – belinea Dec 5 '13 at 9:33
  • registration_form.html doesn't actually have form declaration line. I can't find a layout that would wrap the registration_form.html. Any ideas? – belinea Dec 5 '13 at 14:49
  • Are you looking for the form css ID? Look at the page source on the front-end. There has to be a form tag. – Anna_MediaGirl Dec 5 '13 at 16:17

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.