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 /

Custom form question


Reply


2 Posts   1348 Views

Avatar
SilverRay

Community Member, 167 Posts

15 May 2009 at 9:41pm

Edited: 16/05/2009 12:01am

OK, simple question. I have this custom form:

   function TestForm() {
      $fields = new FieldSet(
         new TextField('NumA', 'Number A'),
         new TextField('NumB', 'Number B')
      );
      
      $actions = new FieldSet(
         new FormAction('doSubmitNumbers', 'Calculate')
      );

      $form = new Form(
         $this,
         'Form',
         $fields,
         $actions
      );
      return $form;
   }

The only thing I want the function doSubmitNumbers to do, is to perform some calculation (say, add NumA and NumB) and show the result on the page when it redirects back. I know how I would use doSubmitNumbers to save to the database, but I actually don't want to save to the database, just show the result of the calculation... How would I go forward?

Thanks!

Edit: wording.

Avatar
Willr

Forum Moderator, 5513 Posts

18 May 2009 at 7:06pm

doSubmitNumbers doesn't save anything to the database per se, what its used for is "Run doSubmitNumbers() when you have submitted the form" as to what doSubmitNumbers() does - it could write the DB or it could in your case be used to redirect the user and add numbers