Home

forms

Customise buttons in userforms module

Submitted by Barry Keenan

I wanted more control over the styling of submit buttons in the userforms module. The standard button use either an <input> tag or a <button> tag. I needed an extra span so I could style the button super prettyà la:

Read More >>

Customize the Redirect after a successful Member Login

When a Member logs in to /Security/login without a ?BackURL= specified, they are always redirected back to the form with a success message and form without any fields.  While this works great to keep the code/form tight, it is a less than ideal use experience.  Modifying this behavior is a little tricky as much of the controller and rendering actions are fixed in the Security class.  This is further complicated by the use of Director::redirect calls that set response headers when the login form is processed.  I find by overriding the form and replacing it with the excellent useCustomClass call works well.

The Problem: Base /Security/login form redirects to itself on success, always tagging ?BackURL=/home looks sort of messy across your site.

The Solution: Make the base MemberLoginForm redirect somewhere useful on success.

 

Read More >>

Disable Default JavaScript Behaviours


Submitted by Hamish Campbell

By default SilverStripe uses bulky and sometimes unwanted JavaScript libraries to handle form validation and AJAX page commenting features. Often you want to disable this behaviour so you can integrate your own JavaScript code. This is easily achieved with the following two lines in you site configuration file:

mysite/_config.php


 

Read More >>

Add attachments to Silverstripe Form submissions

Submitted by Francisco Arenas

Today I was trying to add a CV file to a silverstripe form for a project and noticed that is not that easy as it sounds. Well with the help of Martijn we figured it out:

First the form

Read More >>