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

Password validation in CMS


Go to End


3 Posts   2846 Views

Avatar
Reflektera

49 Posts

16 January 2009 at 10:25am

Edited: 16/01/2009 10:25am

Don't know if this is the right forum for this but... yeah... anyway...

For various reasons I have to do a custom made user system kind-of -thing. I have a dataobject which represent the member that looks like this:

<?php
class Medlem extends DataObject {	
	static $db = array(
		'Fornamn' => 'Varchar',
		'Efternamn' => 'Varchar',
               ...
         	'Losenord' => 'Varchar(64)'
	);
	static $has_one = array(
		//'Avatar' => 'Image'
		'MinOrganisation' => 'Organisation'
	);

	function getCMSFields_forPopup() {
	
		$fields = new FieldSet(
			new TabSet("Root",
				new Tab(
				$title = 'Main',
					new TextField("Fornamn", "Förnamn"),
					...
					new CalendarDateField("Medlemsdatum", "Datum för medlemskap")
				),
				new Tab('Medlemsuppgifter',
					new HeaderField("Medlemsuppgifter"),
					...
					new ConfirmedPasswordField('Losenord','Lösenord',null,null,false,'Bekräfta lösenordet')
				)
			)

		);
	        return $fields;
	}
}
?>

The problem is that the ConfirmedPasswordField doesn't validate. Seems like there is some javascript missing but I can't figure out how to get it there. Anyone who knows?

Avatar
Reflektera

49 Posts

27 January 2009 at 8:56am

Anyone?

Avatar
dio5

Community Member, 501 Posts

27 January 2009 at 9:04am

I'd say have a look at the popup that occurs with MemberTableField. Afaicr there's a confirmedpasswordfield as well, see how that works.

In most cases, js-validation of formfields did not work in the CMS (2.3 will be different I think), only on frontend. Not sure how it's with the passwordfield though - but I do know the popup of membertablefield has it - so I figure your solution must be there.