Jump to:

1999 Posts in 1408 Topics by 613 members

Form Questions

SilverStripe Forums » Form Questions » Reset Form Action

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

Page: 1
Go to End
Author Topic: 1831 Views
  • Dipak
    Avatar
    Community Member
    8 Posts

    Reset Form Action Link to this post

    I have follwing problems

    1. After calling ResetFormAction i am unable to clear the validation error message.
    2. How can i get the form values in the submission tab of CMS as like UserDefinedForm

    Please help me out.
    Here is code snippet

    function Form() {
          return new Form($this, "Form", new FieldSet(

             // List your fields here
             new TextField("ContactPerson", "Contact Person"),
             new EmailField("Email", "Email address"),
             new DropdownField("Reason", "Your Reason", array(
    "Sales" => "Sales",
    "Marketing" => "Marketing")),
             new PhoneNumberField( $name = "PhoneNumber",
                            $title = "Phone Number "
                            ),
             new TextareaField( $name = "Remarks",
                            $title = "Remark",
                            $rows = 8,
                            $cols = 3
                            )
             

          ), new FieldSet(

             // List the action buttons here
             new FormAction("SubmitAction", "Submit"),
             new ResetFormAction("ClearAction","Clear")

          ),
             new RequiredFields("ContactPerson","Email","Reason")
          );
       }

       /**
       * This function is called when the user submits the form.
       */
       function SubmitAction($data, $form) {

          // Create a new RemarksDetails object and load the form data into it
          $Submissions = new ContactDetails();
          $form->saveInto($Submissions);
          // Write it to the database. This needs to happen before we add it to a group
          $Submissions->write();
          $email = new Email();
    }

    1831 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.