Retrieve XML Data From DNN DynamicForm Datagrid Control

The Datagrid is a new control added to DynamicForm 4 . It is handy to design a set of controls dynamically, for example, you can reuse the same set of controls to collect automobile information for a user if the user has more than one vechile.

You can view the result or email the result without any difficulty. However, if you want the dataset in a relational manner, you need to know some basic query skill to convert XML data into relational table columns.

Here is the code snippet which may be helpful if you come to this page:

with mycte as

(SELECT DynamicForms_ResultsID,

ResponseDateTime,

n.l.value(‘td[1]’,’VARCHAR(200)’) AS td1,

n.l.value(‘td[2]’,’VARCHAR(200)’) AS td2,

n.l.value(‘td[3]’,’VARCHAR(200)’) AS td3

FROM dbo.formdata_mytable

CROSS APPLY MyDGControlName.nodes(‘//tr’) n(l)

)

select * from mycte


JavaScript Custom Trim Function in DNN DynamicForm to Remove Leading/Trailing Space

There is no built-in Trim function in the javascript library implemented for DynamicForm. But you can add a custom trim function at the module definition section and use the function in field client script code. Here is the detail.

You need to add a trim function to the form’s JavaScript section first and then use the simple syntax as you want:

$(LastName) = trim($(LastName)); >>Advanced Field Options >>Client side event >>Put the above Javascript in the box for each Field. Case sensetive so use “trim” instead of “Trim”!

You can put either trim function below to the Javascript section:

>>Setup Module Configuration >>Advanced Coding Options (AJAX, jQuery, JavaScript, Initial SQL DataBind) >> Custom JavaScript File >> JavaScript File

(Add the trim function within this section and click on Update Javascript File and then click on Update Settings

You can choose one of the below trim functions:

function trim(stringToTrim) {

return stringToTrim.replace(/^\s+|\s+$/g,””);

}

/* http://www.somacon.com/p355.php */

Or this one:

function trim(s) {

var l=0;

var r=s.length -1;

while(l < s.length && s[l] == ‘ ‘)

{

l++;

}

while

(r > l && s[r] == ‘ ‘)

{

r-=1;

}

return s.substring(l, r+1);

}

/* http://doc.infosnel.nl/javascript_trim.html */

http://www.datasprings.com/dnn-modules/dynamic-forms/trimming-leading-and-trailing-blanks/


DotNetNuke Web Farm Deployment References

1. Tips For Creating a WebFarm For Your DotNetNuke site :

http://www.datasprings.com/resources/articles-information/creating-a-webfarm-for-your-dotnetnuke-site

2. http://www.dotnetnuke.nl/Portals/16/downloads/documenten/DotNetNuke%20Web%20Farm%20Support.pdf


DNN DynamicForm 4 Intergration with SalesForce.com’s Web-to-Lead Form

You can find a blog of step by step instruction at http://www.datasprings.com/news/blog/postid/38/connecting-salesforce-with-dynamic-forms-via-http-post.

Sign up for a  free Developer Edition environment at developer.force.com;

From App Setup >> Customize >> Lead >> Web-to-Lead  >>

Click on Create Web-to-Lead Form button >>  Choose or create form fields and generate the raw HTML form code;

Copy the form code to clipboard to use the ids of these form’s fields nad Form action URL:

A sample generated from the above action:

<!–  ———————————————————————-  –>
<!–  NOTE: Please add the following <META> element to your page <HEAD>.      –>
<!–  If necessary, please modify the charset parameter to specify the        –>
<!–  character set of your HTML page.                                        –>
<!–  ———————————————————————-  –>

<META HTTP-EQUIV=”Content-type” CONTENT=”text/html; charset=UTF-8″>

<!–  ———————————————————————-  –>
<!–  NOTE: Please add the following <FORM> element to your page.             –>
<!–  ———————————————————————-  –>

<form action=”https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8” method=”POST”>

<input type=hidden name=”oid” value=”00Dd0000000cOc5″>
<input type=hidden name=”retURL” value=”http://”&gt;

<!–  ———————————————————————-  –>
<!–  NOTE: These fields are optional debugging elements.  Please uncomment   –>
<!–  these lines if you wish to test in debug mode.                          –>
<!–  <input type=”hidden” name=”debug” value=1>                              –>
<!–  <input type=”hidden” name=”debugEmail”                                  –>
<!–  value=”jingyang.li@marshpm.com“>                                        –>
<!–  ———————————————————————-  –>

<label for=”first_name”>First Name</label><input  id=”first_name” maxlength=”40″ name=”first_name” size=”20″ type=”text” /><br>

<label for=”last_name”>Last Name</label><input  id=”last_name” maxlength=”80″ name=”last_name” size=”20″ type=”text” /><br>

<label for=”email”>Email</label><input  id=”email” maxlength=”80″ name=”email” size=”20″ type=”text” /><br>

<label for=”company”>Company</label><input  id=”company” maxlength=”40″ name=”company” size=”20″ type=”text” /><br>

<label for=”city”>City</label><input  id=”city” maxlength=”40″ name=”city” size=”20″ type=”text” /><br>

<label for=”state”>State/Province</label><input  id=”state” maxlength=”20″ name=”state” size=”20″ type=”text” /><br>

<input type=”submit” name=”submit”>

</form>

We will hook our Dynamic Form’s Completion Event to use HTTP Post event.

A sample:

HTTP Post  URL:https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8

HTTP Post: oid=00Dd0000000cOc9&first_name=$(FirstName)&last_name=$(LastName)&email=$(Email)&company=$(Comp)&city=$(City)&)&state=$(Region)

The key part here is to construct a query string to pass the input values from dynamic form (shortname synatax) to the Web-to-Lead Form we created at SalesForce.com.

If you can get the result submitted to your SalesForce form, you can refine your forms from both SalesForce and DNN to meet your business requirements.

 

 


DNN 6.1.2 HTML Editor Issue From 5.6.2/3 Site Upgrade

I have run into HTML editor issue with two upgrades from 5.6.2/5.6.3 to 6.1.2. The merged web.config file after upgrade still use the previous HTML editor: FckHtmlEditorProvider.  You need to switch this to DotNetNuke.RadEditorProvider to make the rich text editor to work.

Here is the correct entry in web.config file:

<htmlEditor defaultProvider=”DotNetNuke.RadEditorProvider”>

<providers>

<clear />

<add name=”DotNetNuke.RadEditorProvider” type=”DotNetNuke.Providers.RadEditorProvider.EditorProvider, DotNetNuke.RadEditorProvider” providerPath=”~/DesktopModules/Admin/RadEditorProvider” />

</providers>

</htmlEditor>

 

Edit:

Another way to do this is from Host>>HTML Editor Manager to switch the Editor to DotNetNuke.RadEditorProvider

 

 


DNN to Connect SQL Server with Window Authentication

The connection string is very simple:

<add name=SiteSqlServerconnectionString=Server=DBName1;Database=DNNDB;Trusted_Connection=Yes;/>

In order to use the above window authentication connection, you need to grant database access to Network Service account.

Here is the steps:

 

–1.Create a SQL Server login for the Network Service account.

 

— Sample code: exec sp_grantlogin ‘domainName\WebServerMachineName$’

 

–For marshdb1 to allow access from marshweb2

 

—-**** One time

 

–exec sp_grantlogin ‘INETU\myWEB2$’

 

—-****

 

–Target database

 

use DNNDB

 

go

 

 

 

–2.Create a database user in target database

 

exec sp_grantdbaccess ‘INETU\myWEB2$’

 

 

 

go

 

–Another way

 

–CREATE USER [INETU\myWEB2$] FOR LOGIN [INETU\myWEB2$]

 

–WITH DEFAULT_SCHEMA=[dbo]

 

–GO

 

–3.Place the database user in a database role.

 

EXEC sp_addrolemember‘db_owner’,[INETU\myWEB2$]

 

GO

 

 

 

–If not assigned to dbo, you  need to configure role’s permisson

 

–4.Grant permissions to the role. Ideally, you should grant execute permissions

 

— to selected stored procedures and provide no direct table access.

Just for your information, if you still want to use SQL Server authentication, you can refer to the following connection string:

<addname=SiteSqlServerconnectionString=Server=dbname;Database=DNNDB;uid=AuserName;pwd=auserPass;/>

 

 

 


Some modules installed on DNN 6 are missing Import / Export Content Function

I have installed both FormMaster 2008 and DynamicForm on an DNN 6 instance. Both modules are missing

Import/Export content function.  It seems there is a property named as SupportedFeatures in table DesktopModules is set to default value 0 so the moduel is set to IsPortable = 0,  IsSearchable = 0 and IsUpgradeable=0. The Enumeration for  SupportedFeatures is:

public enum DesktopModuleSupportedFeature
    {
        IsPortable = 1,
        IsSearchable = 2,
        IsUpgradeable = 4
    }

We can run a query to change the setting for SupportedFeature in DesktopModules to value  3 (or 1) to turn on the built-in  IsPortable  function, so we can Import/Export content again in the module setting.

The query will look like this:

UPDATE DesktopModules

SET SupportedFeatures = 3

WHERE FriendlyName =’Form Master 2008′  Or FriendlyName =’Dynamic Forms’

If you run the SQL Script from HOST>SQL:

UPDATE {databaseOwner}[{objectQualifier}DesktopModules]

SET SupportedFeatures = 3

WHERE FriendlyName = ‘Form Master 2008’ OR FriendlyName = ‘Dynamic Forms’

After updating the value, you should restart your DNN website to reflect the change made.


From Net Data Design: DotNetNuke 6.0.1 Database ERD and SQL Specs

Net Data Design has posted DNN 6.0.1 database ERD documents. You can download from NDN website:

http://www.nddllc.net/Blog/ID/302/DotNetNuke-601-Database-ERD-and-SQL-Specs


How to Access DotNetNuke Site in Subfolder from Root

I came across this post with detailed instructions for how to address this issue for shared hosting plans:

DotNetNuke: Installing in Subfolder, Access from Domain Root
http://forum.winhost.com/showthread.php?t=8565

Turn off a Child Portal in DNN (DotNetNuke)

Sometimes you may have a need to turn off a child portal for sometime without using the expiration date host setting.

There is an easy way to do it with IIS’s URLRewrite module.

Here is an example code in web.config file:

<system.webServer>

….

<rewrite>

<rules>

<rule name=”RedirectChildPortal” stopProcessing=”true”>

<match url=”^myChildPortal/$” />

<conditions>

<add input=”{REQUEST_FILENAME}” matchType=”IsFile” negate=”true” />

</conditions>

<action type=”Redirect” url=”SomePage.htm” />

</rule>

</rules>

</rewrite>

</system.webServer>

<system.web>

…..