3 Replies Latest reply on Feb 9, 2008 11:50 AM by Günter Schenk

    Add and/or subract data values in form fields

    Level 1
      I'm trying to have a date value in one field calculated from another. For example Issue date field plus 90 days = Contract Due data field. Is there a way, maybe javascript to do this in a ADD form?

      Thanks for any help,

      Tony
        • 1. Re: Add and/or subract data values in form fields
          Günter Schenk Level 4
          Hi Tony,

          instead of trying that with javascript, I´d rather create a Custom Trigger (type: AFTER) which updates your table´s "contract_due" column by applying MySQL´s DATE_ADD function to ADDT´s transaction value ($tNG->getColumnValue("column_name")), like this:

          "UPDATE tablename SET contract_due = DATE_ADD(".$tNG->getColumnValue("issue_date").",INTERVAL 90 DAY) WHERE primary_key_column = ".$tNG->getPrimaryKeyValue()."";

          That should work, although I´m not sure if you would first have to convert the value of $tNG->getColumnValue("issue_date") back to a valid MySQL date format (YYYY-MM-DD), in case the field "issue_date" displays the date in a different format, like e.g. DD.MM.YYYY

          However I think that a javascript based approach should be avoided whenever possible, because even if that works, the user might modify the "contract_due" field value before submitting the data.

          Cheers,
          Günter Schenk
          Adobe Community Expert, Dreamweaver
          • 2. Re: Add and/or subract data values in form fields
            Level 1
            Thanks Gunter,

            I'll try it. BTW, I took your advice and started over on that huge form. I am also doing the incremental backups. I find dreamweaver incredibly slow when working with ADDT, especially on large forms. I spend half my time waiting for DW to complete tasks. Is there any way to speed this up a bit I've got a very fast computer with tons of ram but it doesn't seem to hep DW at all.

            Thanks again for the great support,

            Tony
            • 3. Re: Add and/or subract data values in form fields
              Günter Schenk Level 4
              Hi Tony,

              ----
              I find dreamweaver incredibly slow when working with ADDT, especially on large forms
              ----

              Indeed, the more form elements and server behaviours you add, the slower Dreamweaver gets. Guess that, depending on how complex a form is already, DW takes increasingly more time to e.g. add a newly inserted behaviour to the list.

              Personally I´ve long given up throwing all possible stuff in one overly complex form and rather try to split it up in several smaller forms -- for several reasons:

              a) it´s easier to debug and less painful to recreate a form with fewer elements

              b) an overly complex form including many bells & whistles will also take longer to load in a browser -- we guys use to develop and run stuff on our localhost, but our customers will run a form from the remote web server, and this usually tends to increase the loading time.

              Cheers,
              Günter Schenk
              Adobe Community Expert, Dreamweaver