mirror of
https://github.com/silverstripe/silverstripe-frameworktest
synced 2024-10-22 11:06:02 +02:00
MINOR Added RecaptchaTestPage
This commit is contained in:
parent
414ba50e04
commit
aad5f035ab
37
code/RecaptchaTestPage.php
Normal file
37
code/RecaptchaTestPage.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
class RecaptchaTestPage extends Page {
|
||||
|
||||
}
|
||||
|
||||
class RecaptchaTestPage_Controller extends Page_Controller {
|
||||
|
||||
function Form() {
|
||||
$fields = new FieldSet(
|
||||
new TextField('MyText')
|
||||
);
|
||||
if(class_exists('RecaptchaField')) {
|
||||
$fields->push(new RecaptchaField('MyRecaptcha'));
|
||||
} else {
|
||||
$fields->push(new LiteralField('<p class="message error">RecaptchaField class not found</p>'));
|
||||
}
|
||||
|
||||
$form = new Form(
|
||||
$this,
|
||||
'Form',
|
||||
$fields,
|
||||
new FieldSet(
|
||||
new FormAction('submit', 'submit')
|
||||
),
|
||||
new RequiredFields(array('MyText'))
|
||||
);
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
function submit($data, $form) {
|
||||
$form->sessionMessage('Hooray!', 'good');
|
||||
|
||||
return Director::redirectBack();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user