5 Replies Latest reply on Jun 3, 2009 1:28 PM by Dennis48755

    Validate 2 E-mail address fields in insert record form

    Dennis48755 Level 1

      Hello,

       

      I have used the Insert Record Form Wizard to create a form, including using the Validate Form Server Behavior to validate many fields.

       

      I can't figure out how to compare & validate 2 E-mail address fields.

       

      After the form was created I opened the existing Validate Form Server Behavior - Advanced tab and built the condition {sub_email2} != {sub_email} but this had no affect on submitting the form.

       

      The other thing I tried was creating a new Compare Transaction Field behavior with the same condition {sub_email2} != {sub_email}, this also seemed to have no affect.

       

      I am just a beginner, so I admit to not really knowing what I'm doing, for me ADDT has been a great aid.

       

      The other thing I noticed, when I tried both the items above, besides not affecting being able to submit the form with different E-mail addresses. The red asterisks indicating a required field, would disappear.

       

      Here is the form http://www.oescahealthregistry.org/forms/pedigree_submission.php this version of the form does NOT include either of my attempts to validate the E-mail fields.

       

      Thanks in advance for your help.

       

      Dennis

        • 1. Re: Validate 2 E-mail address fields in insert record form
          zzipper7

          If I understand your issue, the validation is perfomed by each feild name that looks like this :

           

          $formValidation->addField("Last_Name", true, "text", "", "", "", "");

           

          so each email needs its own form and seperate name Ex email1 email2

           

          If you are trying to put multiple emails in one feild...you are going to have to make something custom.

           

          Comparing them will also have to be custom, though it sounds similar to a login function, you are wanting to perform this comparison prior to insert, that makes it custom.

           

          This is a good question for Gunter..he knows the software very well, there might be a function, mask or something that could be modified.

           

           

          Let me know if I've misunderstood the issue.

          • 2. Re: Validate 2 E-mail address fields in insert record form
            Albert S. Level 3

            Hi,

            A compare statement should work fine. As an example I made small form that inserts name and email (2 fields) using Insert record wizard.

            Name field is required, email field is required and checks that its a valid email structure (soso@test.com). I then finish the wizard.

             

            <input type="text" name="email" id="email" value="<?php echo KT_escapeAttribute($row_rsemail['email']); ?>" size="32" />
            <?php echo $tNGs->displayFieldHint("email");?> <?php echo $tNGs->displayFieldError("email", "email"); ?>

             

            ---

             

            I then add the extra field to the form that the 2nd email will be entered into, this one I called email2, I then copied the display hint and fielderror code from the first email and placed it behind the 2nd email box and changed the text to reflect email2. Which probably doesnt matter but I put it there anyway.

             

            <input name="email2" type="text" id="email2" size="32" />
            <?php echo $tNGs->displayFieldHint("email2");?> <?php echo $tNGs->displayFieldError("email2", "email2"); ?>

             

            ---

             

            Now that I have both email fields in the form, I go to the developer tools under server behavior and select compare transactions fields under form validation.

             

            I hit the + to add a field I then choose email for field, then == for condition, then {POST.email2} for compare to. I enter in an error message and hit ok.

            Thats it the form is ready.

            The first email field will check against email validation and the 2nd email will check against the first email.

             

            I hope that helps.

             

            ---

            Take note that the database actually only has 2 fields to enter data. Then 2nd email field is only for validation.

             

            Message was edited by: Albert S.

            • 3. Re: Validate 2 E-mail address fields in insert record form
              Dennis48755 Level 1

              Thanks Guys,

               

              Albert your instructions did the trick for me.

               

              Actually I think I may have had it working earlier in my testing, but because the other validations & required fields posted their errors prior to the captcha, I assumed (I know, that was my first mistake) the comparison error would also occur before the captcha, when it didn't I figured it wasn't working, and didn't go any further. After following & using Albert's examples I followed through entering the capcha field and it worked. Then I started fiddling with the transaction priorities and was able to set the captcha transaction last.

               

              Originally in the Insert Record Wizard I defined fields (and DB columns) for both email1 & email2, I didn't want to but wasn't sure how to go about inserting a regular form field in the transaction form. In following Alberts examples I decide to try eliminating email2 from the insert record.

               

              Albert where did you come up with {POST.email2}? I couldn't find it in any of the dropdown menu items or link items, finally I just copied it from your post to the Compare to: field in the Compare Transaction window. And it worked.

               

              Thanks again.

              Dennis

              • 4. Re: Validate 2 E-mail address fields in insert record form
                Albert S. Level 3

                Hi Dennis,

                 

                So to reply to your question "Where did I get {POST.email2} from?" I know it wasn't in any of the drop downs because it wasn't really a part of the original transaction. As it was I created a form with only two fields then added the third just to do a compare. That's why it wasn't in a drop down. So I just added it.

                 

                Here is the ADDT manual

                http://help.adobe.com/en_US/Dreamweaver/10.0_ADDT/

                 

                and here is link to some of the markup language that ADDT uses

                http://help.adobe.com/en_US/Dreamweaver/10.0_ADDT/ch8_retrieve_dynamic_data_32.html#102902 7

                 

                There are many things you can do with ADDT outside of the wizard or the preset information that the wizard may find or not find ie. {POST.variable}.

                • 5. Re: Validate 2 E-mail address fields in insert record form
                  Dennis48755 Level 1

                  Thanks again Albert,

                   

                  I have the manual, but hadn't came across the markup stuff in chapter 8.

                   

                  Dennis