6 Replies Latest reply on Feb 21, 2008 11:32 AM by (Marcell_Branco)

    Check form fields against database before registration

      Anyone know how I might use ADDT to make a web registration form check two values against a prefilled database before allowing successfull registration?

      We want to double check that our users have entered a correct *account name* AND the correct *zip code* that goes with it before we allow them to successfully register for our membership system.

      The correct account numbers and zip codes are prefilled in a database table.

      Can't seem to find this type of code in any of the tutorials, inline help or on the old InterAkt documentation.

      many thanks for the help.

      April
        • 1. Re: Check form fields against database before registration
          Günter Schenk Level 4
          Hi April,

          I guess this can be achieved by...

          1. establishing 2 recordsets (SELECT * FROM table_name) for retrieving the zip_code and account_name columns

          2. establishing an "Compare Transaction Fields" instance. Here´s where you can add multiple conditions and e.g. compare form field X against a certain recordset

          Cheers,
          Günter Schenk
          Adobe Community Expert, Dreamweaver
          • 2. Re: Check form fields against database before registration
            Level 1
            Dear Gunter:

            Thanks so much ... now I have an idea of where to start.

            I found some tutorials on the old InterAkt site (and in the in-product help) on how to compare transaction fields. They were mostly working with calendars, dates, and blogs but I'll study how to compare and establish multiple conditions.

            Will post any information I find to solve this issue ... in case it might help others.

            April
            • 3. Re: Check form fields against database before registration
              Hello Gunter,

              Made some research and couldn´t find an answer for a compare transaction fields issue. I think it's time to ask to an expert :) . Hope you could give me a clue:

              I'm developing a tool to register students on courses/seminars. To set up a new course the Admin must fill a form and set a period of time when the registration is allowed online for a certain price. For this my table has "dateStart", "dateEnd", and "price" fields. I've allready inserted successfully 2 "compare transaction field" transactions to my form to make sure that "(dateStart < dateEnd) && (dateEnd > dateStart)".

              Now my issue is:

              If I have allready registered a certain price to be used from 20-02-2008 to 25-02-2008 the validation must avoid the admin from insert a new price in a time frame inside that allready inserted on the database.

              Example:

              id dateStart dateEnd price
              1 20-02-2008 25-02-2008 300.00 -> first inserted
              2 21-02-2008 27-02-2008 310.00 -> incorrect - throw error
              3 18-02-2008 19-02-2008 250.00 -> ok - insert record
              4 16-02-2008 20-02-2008 240.00 -> incorrect - trow error

              There's an option to compare the transaction field to a recordset field but in my case I what to compare it to a result of two recordset fields. Is it possible to achieve this with ADDT? No problem if hand coding is needed (I do it all the time in ADDT).

              Thanks a lot.

              Marcell
              • 4. Re: Check form fields against database before registration
                Günter Schenk Level 4
                Hi Marcell,

                -----
                There's an option to compare the transaction field to a recordset field but in my case I what to compare it to a result of two recordset fields.
                -----

                A very interesting scenario. However, you can set up another Compare Transaction Fields instance which checks against the recordset fields -- I just tried it, and it works fine :-)

                Cheers,
                Günter Schenk
                Adobe Community Expert, Dreamweaver
                • 5. Re: Check form fields against database before registration
                  Günter Schenk Level 4
                  Hi Marcell,

                  I just checked it again, and the suggested solution isn´t really fool-proof, as it doesn´t examine each recordset instance separately.

                  Let´s see if I happen to find a different workaround...

                  Cheers,
                  Günter Schenk
                  Adobe Community Expert, Dreamweaver
                  • 6. Re: Check form fields against database before registration
                    Level 1
                    Hi Günter,

                    Thanks for quick replying. I am trying to build a new class and use it as trigger to accomplish this. I am taking the tNG_FieldCompare as an example to link it to the transaction engine. The condition to check each row in the db will be:

                    if ((($formRange_start >= $dbRange_start) && ($formRange_start <= $dbRange_end)) || (($formRange_end >= $dbRange_start) && ($formRange_end <= $dbRange_end))) {}

                    If you have any suggestions, I'll appreciate. Later I'll post here my results.

                    Cheers.

                    Marcell