I defined the form in my page controller.
function SignUpForm() {
//$field = $this->dataFieldByName('Title');
// Create fields
$fields = new FieldSet(
//new TextField($name = "Seminar Name", $title = "Seminar Name", $value = Title),
new TextField($name = "name", $title = "Name", $value = ""),
new TextField($name = "company_name", $title = "Company Name"),
new TextField($name = "phone_number", $title = "Phone Number"),
new TextField($name = "email", $title = "Email"),
new HiddenField ($name = "Seminar_Name", $value = "???????")
);
// Create actions
$actions = new FieldSet(
new FormAction('doSignUp', 'Sing Up')
);
return new Form($this, 'SignUpForm', $fields, $actions);
}
My hidden field is supposed to have the title of the page as value.
I tried to do like this:
$field = $this->dataFieldByName('Title');
new HiddenField ($name = "Seminar_Name", $field->Title)
but it doesn't work.
Also some fields are supposed to be required. How would I do that?
thanks