Jump to:

1976 Posts in 1306 Topics by 607 members

Form Questions

SilverStripe Forums » Form Questions » custom form for external application

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

Page: 1
Go to End
Author Topic: 964 Views
  • Megabyte
    Avatar
    Community Member
    13 Posts

    custom form for external application Link to this post

    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/');
       
       }
    }

    964 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.