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

Custom Email Form

Go to End



Community Member, 7 Posts

22 October 2009 at 12:08pm


I made a custom email form that I output in my homepage page type
in order for users to subscribe to a newsletter.
The problem is I want the submit button to be an image which I have it
uploaded in my theme images folder. I made the necessary class 'Eform'
in the form.css stylesheet and put the class in the div where the form
is supposed to appear in, but the submit button refuses
to appear as the image defined in the class 'Eform' as background.
Ca somebody help me out please?

class HomePage_Controller extends Page_Controller {

private $defaultGroupID = 4;

function EmailForm() {
return new Form($this, "EmailForm", new FieldSet(

// List your fields here
new EmailField("Email", "Email address")

), new FieldSet(

// List the action buttons here
new FormAction("SignupAction", "Sign up")

), new RequiredFields("Email"));

* This function is called when the user submits the form.
function SignupAction($data, $form) {

// Create a new Member object and load the form data into it
$member = new Member();

// Write it to the database. This needs to happen before we add it to a group

// Add the member to group. (Check if it exists first)
if($group = DataObject::get_one('Group', "ID = $this->defaultGroupID")) {

// Redirect to a page thanking people for registering


// Redirect to a failure page




****** from Layout folder
<div id="Newsletter">
<div id="Newsletterform" class="Eform">

.Eform input.action {
padding: 2px;
background: ../images/submit-button.png;
width: 35px;
height: 35px;
text-indent: -999em;
border: none;
.Eform input.action:hover,
.Eform input.action:focus {
cursor: pointer;

Have a nice day!