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.

Form Questions /

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

Field error message in custom form template

Go to End

3 Posts   1235 Views


Community Member, 13 Posts

30 December 2013 at 3:33pm

In my form processing function I have:

$form->addErrorMessage('Email', 'Your email address is already registered in our system','bad');

and in my template:


I can see that the bad class has been added to the input, but how do I display an inline error message?


Community Member, 12 Posts

30 December 2013 at 10:37pm

Edited: 31/12/2013 2:47am


Is the code that you are using your own, or is it from Arams SSbits "user registration and edit member profiles tutorial"? if it is from SSbits then this is what i had to do to get it to work (SS 3.1)

public function submit($data, $form) {
        // Throw error if email is not unique
        if (!($data['Email']) || Member::get()->filter('Email', $data['Email'])->Count()) {
            $form->addErrorMessage('Email', 'Email in use,please use another', 'bad'); 
            //Set form data from submitted values
           // Session::set("", $data);
            return $this->redirectBack();

I had to make many changes to have the SSbits code compatible with SS3.1, if you would like the complete (working 100% code) then i have no problem zipping it and attaching to this post, if you do want the archive just holler..



Community Member, 13 Posts

31 December 2013 at 12:28pm

Hi Martin,

It is my own code. I don't have a problem with validating whether the email address exists, just with displaying the error message underneath the email field - or any other messages under their respective fields.

This seems like something that should be very easy to do, take the laravel framework for example -

If you have a custom SS template I would love to have a look at it and see if it helps.