|
|
|
|
www.DynamicGeneration.com Joined: 6/24/2003
Posts: 63
|
|
|
Note re DNN-3706: The fix in DNN 4.3.5 is only a "partial" fix of the ValidationExpression problem in Profile Definitions.
I have posted the bug to the public Gemini, and am re-producing the details of it here. I hope to get a closer look at the "why", as a functioning ValidationExpression is a required use case for a client of mine.
DNNP-4205
The issue DNN-3706 that was "fixed" in DNN 4.3.5 is only "partially" fixed.
(Added Note: While this bug is rated as "Minor", it does produce an exception when attempting to edit user profiles and may be considered "Major" for some use cases where profile validation is deemed essential.)
While the ValidationExpression column in the ProfilePropertyDefinition is indeed expanded to 2000 characters (from 100) as per DNN-3706, attempting to store a ValidationExpression via the Add/Edit Profile Property admin page only stores the first 100 characters.
How to reproduce: 1) Fresh DNN4.3.5 install 2) Add profile property "Birthdate" with a datatype Text and length 10, make it required and visible, and... 3) Set the ValidationExpression in the form to the following: (^((((0[1-9])|([1-2][0-9])|(3[0-1]))|([1-9]))\x2F(((0[1-9])|(1[0-2]))|([1-9]))\x2F(([0-9]{2})|(((19)|([2]([0]{1})))([0-9]{2}))))$)
It will truncate at 100 characters to store in the db table as this value: (^((((0[1-9])|([1-2][0-9])|(3[0-1]))|([1-9]))\x2F(((0[1-9])|(1[0-2]))|([1-9]))\x2F(([0-9]{2})|(((19)
This validation expression is to ensure that a valid date is entered between 1/1/1900 to 31/12/2099 (as taken from regexlib.com).
This truncated value will prevent any attempt to edit a user's profile with the following exception details:
AssemblyVersion: 04.03.05 PortalID: 0 PortalName: My Website UserID: 1 UserName: host ActiveTabID: 42 ActiveTabName: User Accounts RawURL: /435Install/Admin/UserAccounts/tabid/42/ctl/Edit/mid/357/UserId/2/Default.aspx AbsoluteURL: /435Install/Default.aspx AbsoluteURLReferrer: http://localhost/435Install/Admin/UserAccounts/tabid/42/ctl/Edit/mid/357/UserId/2/Default.aspx UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.2) DefaultDataProvider: DotNetNuke.Data.SqlDataProvider, DotNetNuke.SqlDataProvider ExceptionGUID: 0be5e0e8-f7dd-447b-84b5-d7026c641fea InnerException: (^((((0[1-9])|([1-2][0-9])|(3[0-1]))|([1-9]))\x2F(((0[1-9])|(1[0-2]))|([1-9]))\x2F(([0-9]{2})|(((19) is not a valid regular expression. FileName: FileLineNumber: 0 FileColumnNumber: 0 Method: System.Text.RegularExpressions.RegexParser.ScanRegex StackTrace: Message: DotNetNuke.Services.Exceptions.PageLoadException: (^((((0[1-9])|([1-2][0-9])|(3[0-1]))|([1-9]))\x2F(((0[1-9])|(1[0-2]))|([1-9]))\x2F(([0-9]{2})|(((19) is not a valid regular expression. ---> System.Web.HttpException: (^((((0[1-9])|([1-2][0-9])|(3[0-1]))|([1-9]))\x2F(((0[1-9])|(1[0-2]))|([1-9]))\x2F(([0-9]{2})|(((19) is not a valid regular expression. ---> System.ArgumentException: parsing "(^((((0[1-9])|([1-2][0-9])|(3[0-1]))|([1-9]))\x2F(((0[1-9])|(1[0-2]))|([1-9]))\x2F(([0-9]{2})|(((19)" - Not enough )'s. at System.Text.RegularExpressions.RegexParser.ScanRegex() at System.Text.RegularExpressions.RegexParser.Parse(String re, RegexOptions op) at System.Text.RegularExpressions.Regex..ctor(String pattern, RegexOptions options, Boolean useCache) at System.Text.RegularExpressions.Regex.IsMatch(String input, String pattern) at System.Web.UI.WebControls.RegularExpressionValidator.set_ValidationExpression(String value) --- End of inner exception stack trace --- at System.Web.UI.WebControls.RegularExpressionValidator.set_ValidationExpression(String value) at DotNetNuke.UI.WebControls.FieldEditorControl.BuildValidators(EditorInfo editInfo, String targetId) at DotNetNuke.UI.WebControls.FieldEditorControl.BuildDiv(EditorInfo editInfo) at DotNetNuke.UI.WebControls.FieldEditorControl.CreateEditor() at DotNetNuke.UI.WebControls.FieldEditorControl.DataBind() at DotNetNuke.UI.WebControls.PropertyEditorControl.AddEditorRow(Table& tbl, String name, IEditorInfoAdapter adapter) at DotNetNuke.UI.WebControls.CollectionEditorControl.AddEditorRow(Table& tbl, Object obj) at DotNetNuke.UI.WebControls.PropertyEditorControl.CreateEditor() at DotNetNuke.UI.WebControls.ProfileEditorControl.CreateEditor() at DotNetNuke.UI.WebControls.PropertyEditorControl.DataBind() at DotNetNuke.Modules.Admin.Users.Profile.DataBind() at DotNetNuke.Modules.Admin.Users.ManageUsers.ShowPanel() at DotNetNuke.Modules.Admin.Users.ManageUsers.cmdProfile_Click(Object sender, EventArgs e) at DotNetNuke.UI.WebControls.CommandButton.RaiseClick(Object sender, EventArgs e) at System.Web.UI.WebControls.LinkButton.OnClick(EventArgs e) at System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) at System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) --- End of inner exception stack trace --- Source: Server Name: DG-NX01
|
|
|
|
| |
|
|
|
www.DynamicGeneration.com Joined: 6/24/2003
Posts: 63
|
|
|
Here's the fix. Quite simple, really. In DNN 4.3.5 (and 3.3.5) the following Add/Update stored procedures needed their @ValidationExpression parameter set to 2000 characters (from 100).
Here's the "patch" script:
/* Fix AddPropertyDefinition */
/********************************/
IF EXISTS ( SELECT * FROM sysobjects WHERE id = object_id(N'{databaseOwner}{objectQualifier}AddPropertyDefinition') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE {databaseOwner}{objectQualifier}AddPropertyDefinition
GO
CREATE PROCEDURE {databaseOwner}{objectQualifier}AddPropertyDefinition
@PortalId int,
@ModuleDefId int,
@DataType int,
@DefaultValue nvarchar(50),
@PropertyCategory nvarchar(50),
@PropertyName nvarchar(50),
@Required bit,
@ValidationExpression nvarchar(2000),
@ViewOrder int,
@Visible bit,
@Length int
AS
DECLARE @PropertyDefinitionId int
SELECT @PropertyDefinitionId = PropertyDefinitionId
FROM {objectQualifier}ProfilePropertyDefinition
WHERE (PortalId = @PortalId OR (PortalId IS NULL AND @PortalId IS NULL))
AND PropertyName = @PropertyName
IF @PropertyDefinitionId is null
BEGIN
INSERT {objectQualifier}ProfilePropertyDefinition (
PortalId ,
ModuleDefId ,
Deleted ,
DataType ,
DefaultValue ,
PropertyCategory ,
PropertyName ,
Required ,
ValidationExpression ,
ViewOrder ,
Visible ,
Length
)
VALUES (
@PortalId ,
@ModuleDefId ,
0 ,
@DataType ,
@DefaultValue ,
@PropertyCategory ,
@PropertyName ,
@Required ,
@ValidationExpression ,
@ViewOrder ,
@Visible ,
@Length
)
SELECT @PropertyDefinitionId = SCOPE_IDENTITY()
END
ELSE
BEGIN
UPDATE {objectQualifier}ProfilePropertyDefinition
SET DataType = @DataType,
ModuleDefId = @ModuleDefId,
DefaultValue = @DefaultValue,
PropertyCategory = @PropertyCategory,
Required = @Required,
ValidationExpression = @ValidationExpression,
ViewOrder = @ViewOrder,
Deleted = 0,
Visible = @Visible,
Length = @Length
WHERE PropertyDefinitionId = @PropertyDefinitionId
END
SELECT @PropertyDefinitionId
GO
/* Fix Update Property Definition Stored Procedures */
/****************************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}UpdatePropertyDefinition]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE {databaseOwner}[{objectQualifier}UpdatePropertyDefinition]
GO
CREATE PROCEDURE {databaseOwner}[{objectQualifier}UpdatePropertyDefinition]
@PropertyDefinitionId int,
@DataType int,
@DefaultValue nvarchar(50),
@PropertyCategory nvarchar(50),
@PropertyName nvarchar(50),
@Required bit,
@ValidationExpression nvarchar(2000),
@ViewOrder int,
@Visible bit,
@Length int
as
UPDATE {databaseOwner}{objectQualifier}ProfilePropertyDefinition
SET DataType = @DataType,
DefaultValue = @DefaultValue,
PropertyCategory = @PropertyCategory,
PropertyName = @PropertyName,
Required = @Required,
ValidationExpression = @ValidationExpression,
ViewOrder = @ViewOrder,
Visible = @Visible,
Length = @Length
WHERE PropertyDefinitionId = @PropertyDefinitionId
GO
|
|
|
|
| |
|
|
|
Joined: 4/8/2004
Posts: 882
|
|
|
Ty for the solution script, however all dnn 4.3.5 users need this?
|
|
|
|
| |
|
|
Joined: 11/10/2005
Posts: 6
|
|
|
Hi, not sure who I should report this too but I have just installed v 4.8.4 and noticed encountered this problem. After a little investigation I narrowed down the the fact that the AddPropertyDefinition stored procedured has been changed to allow a max of 2000 characters for a validation expression. However, the UpdatePropertyDefinition stored procedure had not. I have done this manually on my own DNN installation and it fixes the problem. It obviously needs to be addressed for future releases. Hope that helps someone...
|
|
|
|
| |
|
|
Joined: 9/3/2004
Posts: 2185
|
|
|
Create an account here: http://support.dotnetnuke.com/Main.aspx
Then add a new issue in the section labeled: ** DNN Core Framework and Modules [ PUBLIC ] ** (DNNP)
Try and be specific about the details and hopefully it'll get checked and picked up.
Rob
|
|
|
|
| |