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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Form Questions /

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

setFormAction after form has been returned


Go to End


1417 Views

Avatar
craig-opticblaze

Community Member, 10 Posts

10 June 2016 at 10:39pm

Edited: 10/06/2016 10:40pm

Hi there,
Is there a way to send form data to an external URL after the form has been returned? setFormAction only works before.

public function PayForm() {
				  
        $fields = new FieldList(
            TextField::create('USER1', 'Name and Surname'),
			TextField::create('EMAIL', 'Email')			
        );

        $actions = new FieldList(
            FormAction::create("doPayment")->setTitle("Pay Now")
        );

        $required = new RequiredFields('Name');
        $form = new Form($this, 'PayForm', $fields, $actions, $required);
		$form->setFormMethod('GET');
        return $form;
    }
               
               
    public function doPayment($data, Form $form) {
		$data['CHECKSUM'] = md5($data['NAME'].$data['SURNAME']);
		$form = new Form($this, 'doPayment', $fields, $actions, $required);

		//Send data to URL here
		
	}
}