This forum is no longer open and is for reading/searching only.

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 2

Verify email address with duplicate fields


  1. cyberk
    Member

    We've got a client that wants the user to enter their email address twice, and have the form verify that the two fields match.

    Can someone point me to the right place to hack this in? I'm an experienced PHP programmer so I just need a little nudge toward the right place to add this.

    Thanks!

    Posted 16 years ago #
  2. Saghalie
    Pro Member

    Are you using the embed function for your client? Or are you creating the form, cutting and pasting and sending that form off to your client?

    Posted 16 years ago #
  3. cyberk
    Member

    Embedding. Although I suppose we could do the other if it will make things considerably easier.

    Posted 16 years ago #
  4. Saghalie
    Pro Member

    I'll let qton answer the part about his own code (where to tweak it and all that).

    IMHO,

    It would be easier to just create the form, cut and paste, fix up the element_* ID's, action a PHP script that has the checks in it and you're off and running. I have a nice script that I'm working on for a newsletter subscription service (ezmlm) and this is what I have done.

    Maybe in a future release? That would be a nice feature.

    HOIT!

    Saghalie
    http://www.beautiful-beginnings.org

    Posted 16 years ago #
  5. Saghalie
    Pro Member

    Correction.

    change qton to Yuniar!

    Getting my lists mixed up!

    Posted 16 years ago #
  6. yuniar

    cyberk, you can start looking at includes/common-validator.php file.
    All validation functions are defined there.

    Those functions are being called by process_form() function defined in includes/post-functions.php

    Hope that helps.


    MachForm Founder

    Posted 16 years ago #
  7. cyberk
    Member

    Cool, I looked at common-validator, but what I'm not sure of is how to get the content of the other email field. I even see a "equal" comparison function but I'm not sure where to pull the value of the two different email fields. Any hints?

    Thanks!

    Posted 16 years ago #
  8. yuniar

    Actually, I prepared that "equal" comparison function for this purpose. Comparing two fields, but didn't get the chance to implement the whole functionality.

    From process_form() function, you could get the content of the other email by accessing the $user_input array. For example $user_input['element_3'];

    Try to dump the $user_input variable and you'll see it. It hold the whole form inputs.


    MachForm Founder

    Posted 16 years ago #
  9. cyberk
    Member

    Aha, that should do it. Thanks so much!!!

    Andrew

    Posted 16 years ago #
  10. cyberk
    Member

    I did get this working, albeit in an entirely ugly, hackish manner on the back end. From the user perspective it looks and works perfectly, but my code is a bit unattractive.

    Thanks for the help!

    Andrew

    Posted 16 years ago #
  11. yuniar

    Sounds great :-)


    MachForm Founder

    Posted 16 years ago #

RSS feed for this topic

Reply