Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Form Questions /

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

UniqueTextField allowing duplicates


Go to End


1793 Views

Avatar
PapaBear

Community Member, 26 Posts

28 May 2010 at 8:05pm

Edited: 28/05/2010 8:06pm

Hi All,

I am using UniqueTextField in a custom form to make sure that email (for login) and username(for in site ID) are unique. However, Both the customer and my own testing have identified that duplicates are getting through.

My constructor for the appropriate fields is:

	function __construct( $controller, $name ){
		$locale = i18n::get_locale();
		$fields = new FieldSet (
			new UniqueTextField("Email", 'Email', 'Member', 'That email is already in use.' ),
			new UniqueTextField("Username", 'Username', 'SiteUser', 'That username is already in use.' ),
...
(etc)

Whenever I try to create a new user through the form it is as if no checking is being done at all. Firebug is not reporting any errors. All the appropriate js seems to be there (UniqueFields.js, etc)

SiteUser class extends Member if that is relevant.
Using SSv2.3.7

I'm using a custom form because of the complex layout requirements of the site design. Because there are many other required fields I can't just use the validator from the member class to ensure uniqueness for the email.

Can anyone please help? This is urgent as phase one of the site is already live and taking the site down while this is resolved is not an option.

Cheers
James.