Recently Viewed...
DNN Modules
SnowCovered Top Sellers

Edit documents directly on your server. The premier document management solution for DotNetNuke (DNN). Index contents of documents. Share documents across your portal and avoid duplicates. Revised and flexible UI. Extensible architecture.

'Relationship Building' and 'Communication' are two essential nuts and bolts for a business to prosper. This module allows you to bridge both of these and easily generate continuous awareness of your web site, products and services. Your prospects and customers will greatly appreciate this featur

Live Content uses Web 2.0 approach to provide a Rich User Interface and streamlines content presentation by overlaying content on current page. Overlay images, videos, audio, text/html content, flash, dotnetnuke modules, and external content. Experience the demo...

The Catalyst skins are professionally designed, coded and packaged by a team of DotNetNuke experts. The skins are available in 12 great colours. This skin is easily customisable with our unique DrNuke EasyMod technology. Try our demo!

In this day and age, knowing as much detailed information as possible about your customer, prospect or web site user is essential. Thankfully, the new 'Dynamics Forms' module from Data Springs, makes it easier than ever to segment your data collection efforts.

Ultra Video Gallery is a brother product of Ultra Media Gallery, UVG allows you to add videos in various format and automatically convert them to flv format, you also can add videos from embed code and play them in our integrated flash video player.

Ultra Media Gallery is the most popular photo gallery and media gallery solution for DotNetNuke, UMG offers 10 different flash player to browse your gallery with completely different user interface experience.

Capture your users attention, enrich your site with multimedia flash, and create and opt in distribution list for your DNN site. These are just a few of the many features the Data Springs Module Collection can provide you.

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.

ALL NEW ! - Minimalist includes skin packs in 12 great colors. Each color has Flat, Gradient and Glass versions. Feature rich XML Flash header, perfect for just about any purpose. 9 Different menu options in each skin pack; 3 horizontal menus, 3 vertical menus and 3 all-new Twin level menus . . .

    |   Register   |   Sunday, November 23, 2008   
Data Springs Product Forums...
Subject: SQL Validation
Prev Next
You are not authorized to post a reply.

Author Messages
Tim
Posts:6
skipping stones
skipping stones

07/22/2008 8:27 PM  

Hi,

Can you please give an example of a SQL validation script (i.e. stored procedure)? In particular what should the parameter be named - assuming the question value can be passed as a parameter?

thanks,
Tim

Troy
Posts:14
wading in the water
wading in the water

07/23/2008 12:47 PM  

I, too, am trying to figure out the proper syntax for SQL validation.  I tried the following syntax for a dynamic query (for testing purposes) for the CompanyCode field:

 

select count(*) as IsValid
from wm_Companies
where code = '$(CompanyCode)'

 

The validation error message ("You must enter your company's identity code") does display if I leave the textbox blank or enter gibberish AS LONG AS I fail to enter a username and password (if I fill in the latter fields then I can successfully register without specify a company code or any of the other fields like First name).

 

I failed to find suitable examples in the user manual or forum but I'll keep looking.

 

Troy

Chad
Posts:2227
river guide
river guide

07/23/2008 10:17 PM  
Hmmm... When you go to validation configuration does it show that you have server side validation turned on?
Troy
Posts:14
wading in the water
wading in the water

07/24/2008 5:28 AM  

Yes, server-side validation is checked.  It *is* validating the field somewhat since I receive the validation error message but since it isn't a required field, I can register without entering a valid company code.

 

I guess my real question should be: how do I make fields required (even First Name isn't required)?  I checked the Required Field & Enable Custom SQL Validation Script checkboxes on Question Validation for CompanyCode. 

 

Currently, to register I need only enter data for username, password and confirm password.  I'd like to make all fields mandatory (first name, last name, display name, captcha, etc) as well as validate Company Code.

 

Troy
Posts:14
wading in the water
wading in the water

07/24/2008 7:10 AM  

I've made some progress and learned a few things along the way.

 

First, I've made all fields required.

 

Second, I can successfully use "select 0 as IsValid" to prevent a user from registering since SQL validation fails (testing purposes only). 

 

Third, if I change the SQL query to "select count(*) as IsValid from my_nonexistent_table" then the user can still register even though there's no such SQL table.  Why is that?

Tim
Posts:6
skipping stones
skipping stones

07/24/2008 6:44 PM  
I've also worked out how to do it i.e. in my case check if a suburb/town and its associated postal code matches values in a table I've imported into the DotNetNuke database:

Stored Procedure:

CREATE PROCEDURE spSuburbCheck
@Suburb NVARCHAR(50),
@Postalcode NVARCHAR(50)
AS
SELECT COUNT(*) AS IsValid
FROM Suburbs
WHERE Suburb = @Suburb AND Postalcode = @Postalcode

and the SQL in the module question is:

EXEC spSuburbCheck '$(Suburb)', '$(Postalcode)'

Seems to work.
Troy
Posts:14
wading in the water
wading in the water

07/25/2008 5:32 AM  

For my situation I don't think the problem is the backend (db) but rather the configuration of either the dynamic field or DNN itself.  Here are the pertinent settings for the dynamic field:

 

Question Type:  textbox (single line)
(no boxes in Advanced Field Options are checked)
Required Field:  checked
Required Text: Company Registration Code is required
Required Field Error: * Required
Enable custom SQL validation script: checked
Validation SQL query: exec spValidateCompanyCode '$(CompanyCode)'
(also tried dynamic query)
Validation Error Message: Invalid company registration code

 

The user cannot register without providing a company code but DNN accepts any text in the box as legitimate.

 

The big question is the one I previously posted: why does the following query not prevent a user from registering?  "select count(*) as IsValid from my_nonexistent_table"

 

p.s.  I like the option to immediately validate the chosen username but this option prevents tabbing to the next textbox from working correctly (it steals the focus, which is not user friendly).

Troy
Posts:14
wading in the water
wading in the water

07/25/2008 6:57 AM  
Another p.s. Upon clicking the Register link, sometimes the message "You do not have access to view this module within the portal." is displayed at the top of the current page (the registration module disappears) instead of going to the Home page. Me thinks my installation may be FUBAR.
Troy
Posts:14
wading in the water
wading in the water

07/25/2008 9:48 AM  

I uninstalled & reinstalled the module and now the SQL validaton works for the Company Code field.  However, if the SQL query is bogus the user is still able to register.

For example, I can set the SQL query to be "abcd" (no quotes) and the user can register by entering any garbage text in the Company Code textbox (no error message about the malformed SQL query is displayed).  Obviously, this should not be allowed.

dom
Posts:10
wading in the water
wading in the water

07/29/2008 7:45 AM  

My question is the following

One user wrote that these are his option for field validation below

Question Type:  textbox (single line)
(no boxes in Advanced Field Options are checked)
Required Field:  checked
Required Text: Company Registration Code is required
Required Field Error: * Required
Enable custom SQL validation script: checked
Validation SQL query: exec spValidateCompanyCode '$(CompanyCode)'
(also tried dynamic query)
Validation Error Message: Invalid company registration code

 

UNTILL required filed error is fine

The option Enable SQL validation script is missing from mine question options im using Dynamic Registration version 03.03.50.

 

IS this option available on any latter versions of Dynamic Registration

Chad
Posts:2227
river guide
river guide

07/31/2008 1:12 PM  

Hi Yes this was not available until version 3.2 and you are running on 3.0 (3.03.50) but that is actually still lower then 3.2.

-Chad

Troy
Posts:14
wading in the water
wading in the water

09/04/2008 10:33 AM  

Ugh, this problem has raised its head again, this time on a different installation.  So I did what I did before--uninstall & reinstall the module and configure it once again.  Still the same problem.

 

My steps:

- installed enterprise module (version 3.20.60)

- added module to a page

- ran through setup wizard, taking the 7 default fields

- clicked Update Registration

- enabled client-side/server-side/AJAX/email validation and enabled Display Validation Summary Message via Module Configuration-->Validation Configuration

- added a new dynamic field, RsvpCode, as a short, singleline textbox

- configured things like required text, etc

- set new field to required and enabled custom SQL validation via wm_ValidateCompanyRsvpCode '$(RsvpCode)'

- clicked Update Field link

- tested it out using a fake rsvp code--it succeeded even though it shouldn't since the stored procedure called is set to 'select 0 as IsValid'

 

I'm open to ideas/suggestions.

 

Troy

Troy
Posts:14
wading in the water
wading in the water

09/04/2008 1:05 PM  

I think I'm zeroing in on the problem. 

 

I tried executing the stored procedure via Host-->SQL and received the following error.

 

System.Data.SqlClient.SqlException: Could not find stored procedure 'wm_ValidateCompanyRsvpCode'

 

Since I'm 100% positive the stored procedure is present and is spelled correctly, I assume the problem is permissions.  The source database is Database.mdf via the file system, with a connection string = "Data Source=.\SQLExpress;AttachDbFilename=|DataDirectory|Database.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient".  Not sure why it was done that way but it's what I'm stuck with.

 

Any thoughts on proper permissions or other ideas?  Danke!

 

Troy

Troy
Posts:14
wading in the water
wading in the water

09/10/2008 8:03 AM  

Update: I figured out the whole permissions issue.  It was an issue with using SQL Server Managements Studio (SSMS) to access the SQLEXPRESS database while DNN had active connections to it.  I fixed the problem by following the steps outlined via http://www.dotnetnuke.com/Community/BlogsDotNetNuke/tabid/825/EntryID/1202/Default.aspx.

 

I still don't understand why executing a bad SQL query allows a user to register--the Dynamic Registration module should display an error message and prevent registration (essentially IsValid = 0).  This is one of those "What were they thinking?" situations.

Chad
Posts:2227
river guide
river guide

09/10/2008 11:49 AM  
Troy,

Hi. Thanks for your update and post on this, I am sure this will be helpful for other users. We will review for failed SQL queries what should happen down the road, each implementation is different but it should at least notify the Administrator when something like this happens.



-Chad
You are not authorized to post a reply.



ActiveForums 3.7

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