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.

Form Questions

Reset Form Action


Reply

1885 Views

Avatar
Dipak

12 February 2009 at 2:07am (Last edited: 12 February 2009 2:11am), Community Member, 8 Posts

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();
}