Recently Viewed...
DNN Modules
SnowCovered Top Sellers

Flex By DrNuke
The Flex skins are professionally designed, coded and packaged by a team of DotNetNuke experts. Available in 8 great colours, each with 15 banner images, 2 menu types and a choice of 3 background styles. The entire pack features a total of 2376 skins!

Ultra Media Gallery 5.2
Ultra Media Gallery is the most popular photo gallery and media gallery module for DotNetNuke, the major purpose of this module is to allow you create unlimited pictures and medias to your gallery and organize them by albums, your albums and medias are browsed in flash interface.

Open-DocumentLibrary v3.0
Powerful, Ajax Enabled, Easy to Use. Document Management has never been better. Open-DocumentLibrary allows DotNetNuke users to share and manage documents in a flexible, intelligent way, offering granular control over Folder and Document access.

Ultra Video Gallery 2.3
Ultra Video Gallery is a brother product of Ultra Media Gallery, The major purpose of this product is to provide an easy way to add videos in various formats to your website by and play them in a unique flash gallery.

XMod 5.1
Version 5 of the perennial best-selling tool for creating data-based solutions in DNN without custom programming. This version focuses on greater flexibility, expandability, and ease-of-use.

Aero // 8 colors // multi-theme skin pack (New)
aero is a flexible skin pack, featuring 8 incredible colors.Combine 3 background layouts, 3 widths and 6 headers to create your own, personalized site.

Events Calender and Registration 2.1 for DNN4.xx
One stop solution for events calendar and events registration! Demo site available for free trial.

Aurora 2 By DrNuke
The Aurora skins are professionally designed, coded and packaged by a team of DotNetNuke experts. Available in 6 great colours, each with 10 banner images, 10 inner banner images and a choice of 3 background types. The entire pack features a total of 444 skins!

Active Forums 3.7 Enterprise
Active Forums is a Forum module which has been written specifically for DotNetNuke . Active Forums is packed with functionality while maintaining administrator flexibility.

Minimalist by Evan O'Neil
Minimalist by Evan O'Neil - the Web 2.0 skin for DotNetNuke, loads fast, looks great. Minimalist is also one of the most flexible and functional skins available for DNN. Minimalist includes skin packs in 12 great colors, each color has Flat and Styled versions. 4 Different menu options in each skin
    |   Register   |   Friday, July 04, 2008   
Data Springs Product Forums...
Subject: Using SQL to validate a value in a text box
Prev Next
You are not authorized to post a reply.

Author Messages
Adrian
Posts:3


05/12/2008 6:24 PM  

I've looked through the documentation but I'm having trouble finding how to do the following.

I have a text box that the user needs to add a valid employee number.

I know how to retreive the employee numbers from a database, but can't see how to use that to validate against the value entered in the text box.

Any assistance would be greatly appreciated.

Kind regards,

Adrian Scott-Day

Chad
Posts:1650
river guide
river guide

05/13/2008 9:51 AM  
Hi. Well in the next release we will probably be adding SQL Validation to each individual question level and not on the complete form. For your situation it shouldn't matter but just a heads up (this will allow you to be able to add multiple SQL validations throughout the form).

For now its pretty straight forward... You need to return one SQL column called 'IsValid' and that SQL column should return either a 0 or 'False'. So... In your case lets say you have an employee numbers table called EmpNumbers. You could do something like this (set this up as a stored procedure to guard against SQL injection etc...)


Select Count(*) as IsValid from EmpNumbers where EmployeeID = '$(EmpIDShortFieldName)'

This way when the user hits submit it will check the Employee ID against the database. If its valid it will return a row count of 1 (meaning True as anything besides 0 or 'False' will render true). So, if the user enters an ID that is not present in the database the SQL statement will return 0 (since the row count on that condition is 0) and therefore the user will fail validation and cannot continue.


Hope this helps!

-Chad
You are not authorized to post a reply.
Forums > Product Discussion - DotNetNuke Modules > Dynamic Forms > Using SQL to validate a value in a text box



ActiveForums 3.7

Copyright 2005 - 2008 by Data Springs, Inc.
Terms Of Use | Privacy Statement