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.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Form Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

custom form for external application


Go to End


1404 Views

Avatar
Megabyte

Community Member, 13 Posts

19 October 2009 at 9:27am

Edited: 19/10/2009 9:33am

Hello,
I tryed to build a form that send the input data to another PHP-script. This script write the data into a database. But how can I sent the data to this script. I tryed it in this way, but it does not work:

class NewsletterFormPage extends Page
{
}
class NewsletterFormPage_Controller extends Page_Controller
{
    function NewsletterForm()
    {
        return new NewsletterForm($this,'NewsletterForm');
    }
}

and
class NewsletterForm extends Form {
function __construct($controller, $name)
    {
		$fields = new FieldSet(
			new TextField("Name", "Name"),
			new EmailField("Email", "E-Mail")
        	);
		$actions = new FieldSet(
 			new FormAction("submit", "Speichern")
		);
		$requiredFields = new RequiredFields("Name", "Email");
 
	parent::__construct($controller, $name, $fields, $actions, $requiredFields);

	}
 
function submit($data, $form) {
 
       $form->setFormAction('http://www.url.com/');
	
	}
}