1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
function UserProductReviewForm() { 
// Create fields 
$fields = new FieldSet( 
                      new TextField('Name','Name:'), 
                      new EmailField('Email','E-Mail Address:'), 
                      new TextField('Location','Location:'), 
                      new OptionsetField('Rating','Rating',array( 
                                                      '1' => '1', 
                                                      '2' => '2', 
                                                      '3' => '3', 
                                                      '4' => '4', 
                                                      '5' => '5', 
                                                      ) 
                                    ), 
                      new TextField('Title','Review Title:'), 
                      new TextareaField('Review'),
                      new HiddenField('ProductID', '', $this->ID), 
                      new HiddenField('ProductName','',$this->Title) 
);

// Create actions 
$actions = new FieldSet( 
new FormAction('doReview', 'Submit') 
);

$form = new Form($this, 'UserProductReviewForm', $fields, $actions); 

$protector = SpamProtectorManager::update_form($form, 'ProductID'); 

return $form;
}