Ready to get started?

Help Files / User Guides

Review the new and improved user guides including instructions on setting up the Dynamic Forms module, explanation of features,  product information, and more!

 

User Guide (PDF)

 

Demonstrations

View Dynamic Forms Demonstrations

Dynamic Forms Video Tutorial

 

Trial Version

Dynamic Forms 3.1 Trial

 

Purchase Dynamic Forms

Dynamic Forms 3.1 w/ Snowcovered


 

License Agreement

Standard Version

Enterprise Edition

 

Recently Viewed...
DNN Modules
   
    |   Register   |   Friday, March 12, 2010   
You are here:Products  DNN Modules  Dynamic Forms  Dynamic Forms Demonstration 12  


Dynamic Forms Demonstration 12 - SQL Validation

Search      
Dynamic Forms Demonstration 12 - SQL Validation

The demonstrates illustrates how to validate a user's input using the SQL Validation functionality. This functionality allows you to execute a SQL statement to determine if the user's input is valid, and provide immediate feedback if it is not.
In order to implement this functionality we will do the following:

Create the Question


1) Create the question that will accept the user's input and set the following properties:

  • Give it the name "Product"
  • Give it the shortname "ProductName"
  • Set the "Question Type" to "Textbox"...Singleline textbox (Short)
  • If the field will be required, then set it's properties accordingly under the "Question Validation" settings.

 

Setup the SQL Validation


2) Under "Module Configuration" > "Validation Configuration" set the following properties:

  • Check the "Enable Server-side Validation" checkbox
  • Check the "Set focus on first validation error field checkbox
  • Check the "Enable custom SQL validation script" checkbox.
  • In the "Validation SQL Query" textbox enter the SQL statement or Stored Procedure name to execute to perform the validation.
    • Below is the SQL Stored Procedure created for this demonstration (this was created one time under Host, SQL):
      • CREATE PROCEDURE [dbo].[stp_SQLValidation]
        @ProductName nvarchar(100)
        AS
        SELECT COUNT(*) As IsValid
        FROM AdventureWorks.Production.Product
        WHERE Name = @ProductName
    • Below is the SQL that is called from within the 'Validation SQL Query' within this demonstration (this is whats entered into this form setting within the module configuration, validation, Validation SQL Query textbox):
      • stp_SQLValidation '$(ProductName)'
    • Note: In order to prevent a possible SQL Injection attack, it is recommended the SQL validation be performed using a stored procedure.
  • In the "Validation Error Message" textbox, enter the message to be displayed to the user in the event the SQL validation has failed.


In the above demonstration, if a user enters an invalid product name into the textbox a message will be displayed stating There were no products that matched your entry. If however, a valid product name is entered, such as "AWC Logo Cap", the form will submit as usual and you will be redirected to the "thank you" page.

Feedback Comments
Records per Page
Page 1 of 1First   Previous   Next   Last   
Feedback





Enter the code shown above in the box below
Send

 
Copyright 2005 - 2010 by Data Springs, Inc.
Contact Us | Terms Of Use | Privacy Statement