Jump to:

10929 Posts in 2613 Topics by 1809 members

All other Modules

SilverStripe Forums » All other Modules » Memberprofiles - Check email field only accept valid email

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1 2
Go to End
Author Topic: 1962 Views
  • ocean
    Avatar
    Community Member
    37 Posts

    Re: Memberprofiles - Check email field only accept valid email Link to this post

    This still seems to be an issue today with latest code, an otherwise really nicely done module is more or less useless for real life use because any old nonsense can be typed into the email field and it posts.

    Anyone managed to get an answer or solution on this one?

    Would love to know!

    Thanks
    Sean

  • ajshort
    Avatar
    Community Member
    244 Posts

    Re: Memberprofiles - Check email field only accept valid email Link to this post

    I just tested this, and it works fine as expected. You just need to replace the email field with an EmailField rather than a TextField using updateMemberFormFields.

  • ocean
    Avatar
    Community Member
    37 Posts

    Re: Memberprofiles - Check email field only accept valid email Link to this post

    Thanks Andrew!

    I've updated with the following code and can confirm the JS require valid email is now working.

    MemberExtension.php

    class MemberExtension extends DataExtension {

    public function updateMemberFormFields(FieldList $fields) {
    $fields->push(new EmailField('Email', 'Email'));
    }

    }

    _config.php

    Object::add_extension('Member', 'MemberExtension');

    1962 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.