Results 1 to 4 of 4

Thread: INI FILES and fmcompute

  1. #1
    Join Date
    Oct 2009
    Posts
    63

    Default INI FILES and fmcompute

    Alright.

    In a previous post , I was told that I can hide the fmcompute in an .ini file. After reading the how-to I am confused because it says it does not handle any multi-form data, which my whole fmcompute does. Also it says it can only have one per formail. But I have two fmcompe1's on two different pages, so How would I make this work.

    Suggestions appreciated.

  2. #2
    Join Date
    Dec 2003
    Posts
    3,980

    Default Re: INI FILES and fmcompute

    Hi,

    Sorry for the delay, I thought I'd already answered this one (maybe in another thread?).

    An INI file gets loaded on every page of a multi-page form. So, depending on what you're specifying in it, this is not useful.

    (We'll be superseding INI files in a future version of FormMail, to avoid this problem.)

    For example, if you specified "recipients" in an INI file, then FormMail would email you after every page submission. In general, not what you want.

    Similarly for "fmcompute1", "fmcompute2", and so - they will get executed after every page submission.

    Now, because of the logic you can implement, this isn't a major hurdle.

    What you need is to provide an "if" statement around the logic that identifies when to execute.

    For example,
    Code:
     total = price_1 + price_2;
    would become:
    Code:
     if (page_number == 3)
     {
       total = price_1 + price_2;
     }
    to ensure that this calculation only happens after page 3.

    Then, on the pages of your multi-page form, you include a hidden field that identifies the page number. On page 1:
    HTML Code:
    <input type="hidden" name="page_number" value="1" />
    And on page 3:
    HTML Code:
    <input type="hidden" name="page_number" value="3" />
    Russell Robinson - Author of Tectite FormMail and FormMailDecoder
    http://www.tectite.com/

  3. #3
    Join Date
    Oct 2009
    Posts
    63

    Default Re: INI FILES and fmcompute

    So could I set up the if statments and just copy the code from the fmcompute, minus the <input type ...............

    Basically start from
    Code:
    import function FMFatalError,FMFatalUserError;
      import function FMUserError;
      import string product1a;
      export string next_form,price,price22,cont,upgrade;
      export float fPrice1(2,'.',','), fsavings(2,'.',','), ship(2,'.',',');
      
      cont = 'not ready';
      price = 'not ready';
      price22 = 'not';
      fsavings = 0;
      ship = 0;
      upgrade = 'not set';
    and go from there. or how does that work?

  4. #4
    Join Date
    Dec 2003
    Posts
    3,980

    Default Re: INI FILES and fmcompute

    Hi,

    Yes.

    Grab the code from your first page's "fmcompute" and put it in the INI file like this:

    Code:
    [special_fields]
    fmcompute1 = "
      import function FMFatalError,FMFatalUserError;
      import function FMUserError;
      import string product1a;
      /* other imports and exports for page1 */
    
      /* logic for page1 */
      "
    Now, simply do this:
    Code:
    [special_fields]
    fmcompute1 = "
      import function FMFatalError,FMFatalUserError;
      import function FMUserError;
      import string product1a;
      import string page_number;
    
    
      if (page_number == '1')
      {
        /* other imports and exports for page1 */
    
        /* logic for page1 */
      }
      "
    Russell Robinson - Author of Tectite FormMail and FormMailDecoder
    http://www.tectite.com/

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. One more thing about CVS files
    By viper54 in forum FormMail Subscription Support
    Replies: 4
    Last Post: 20-Jan-2006, 09:08 PM
  2. .htc files
    By darren777 in forum FormMail Subscription Support
    Replies: 2
    Last Post: 27-Jan-2005, 09:14 AM
  3. Attaching Files from forms
    By Chek in forum FormMail Subscription Support
    Replies: 2
    Last Post: 14-Dec-2004, 10:32 PM
  4. Creating CSV files (databases)
    By russellr in forum HOWTO Guides and Tips
    Replies: 0
    Last Post: 13-Aug-2004, 10:45 PM
  5. Uploading files
    By russellr in forum HOWTO Guides and Tips
    Replies: 0
    Last Post: 31-Jul-2004, 08:42 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •