DF Text box - Validation to unique text
Last Post 03-10-2011 09:24 AM by Ryan Bakerink. 1 Replies.
AddThis - Bookmarking and Sharing Button
Author Messages
hazen wilsonUser is Offline
going with the flow
going with the flow
Posts:35
Avatar

--
03-09-2011 08:54 AM
    Can a text box be validated against a database field for a unique name. (just like when registering usernames for dnn  core)

    I have a form where users sign up and create a group. The group input is a text box.  I need the box to validate against the existing lists of group names in the dababase so that if a user inputs one that already exists.. the form will warn them that they need to select another name.

    Is this possible... if so please point me in the right direction.
    Hazen
    Ryan BakerinkUser is Offline
    river guide
    river guide
    Posts:1900
    Avatar

    --
    03-10-2011 09:24 AM
    Hello Hazen,

    This is SQL validation all of the way. So go into the settings for this Group Name text box and go to "Question Validation" and expand this expandable menu. Now scroll down and you'll see a section for SQL validation, and this is what you can use for the DB validation. For instance I will write how the syntax could look:

    Declare @one int

    set @one = (Select Count(*) from yourTable where GroupName = '$(ShortFieldNameOfGroupNameTextBox)')

    Declare @bool nvarchar(200)

    IF @one > 1
    BEGIN
    set @bool = 'False'
    Select @bool As IsValid
    END

    ELSE
    BEGIN
    set @bool = 'True'
    Select @bool As IsValid
    END

    If you end up having any questions please let us know.

    Thanks,

    Ryan


    ---
  • film izle
  • 720 izle
  • film
  • sinema izle
  • film makinesi
  • T�rk�e dublaj film
  • film izle
  • film izle
  • baglan film izle
  • sinema izle
  • 1080 film izle
  • film mercegi