Is name already exists in database don't save - how to?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Haitashi
    New Member
    • Jun 2007
    • 96

    Is name already exists in database don't save - how to?

    I have collection object. Its recordset has the results of a query. And I have a form. Let's say that the form saves the user's first name. I want to be able to loop though that collection and compare the "firstName" value in the query to what the user has entered in the text input field. If it exists then don't submit the form.

    I will add some nice message when a duplicate is found.

    Not too sure how to go about this.

    Can I do a compare?

    Basically I want to:
    >>Create collection object and populate it with query results
    >>Loop through the recordset of said object and compare it to the value that inputted
    >>If the string values are the same, then don't submit the form.

    Thanks!
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    You can use a cfloop to loop over the collection. Then a comparison is as simple as using a cfif eq.

    Comment

    • Haitashi
      New Member
      • Jun 2007
      • 96

      #3
      You were correct sir. That's what I did. =)

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        That's good to see and thanks for the confirmation :)

        Comment

        Working...