Menu

Action Form Notes

Action Form is a module developed by DNNSharp.com for the DNN Content Management System and Development Platform. The developers at LetItShine.biz have used the Action Form module for countless projects and solutions for a number of years. The following is an modest collection of notes that we have started to record about techniques to take advantage of the strengths of this module. We record this here not to become a secondary help system for Action Form users or DNNSharp. But if you can find something here that helps you, that makes us happy too.

Return to the list

Getting Action Form Data and Reports

Mark Buelsing 0 0 Article rating: No rating

Link to prefill form submissions. 

http://aveschoir.org/ACA-Fest?entry=5da0b1e8-8332-49a6-b76f-94b74caab84f

The GUID that you put in the link can be found in the action form reports table, avtActionForm_Reports.

Here is the token to insert in an email to get a link  back to the form with the content inserted:
[_EditUrl]


Here is a sample SQL query to get that data for a 

SELECT 'ReportEntryId: ' +
      CONVERT(nvarchar(10),ReportEntryId) + ' UserID: ' + 
      CONVERT(nvarchar(10),UserId) + ' submitted on: ' + 
      CONVERT(nvarchar(11),DateSubmitted, 102) + '|' + 
      CONVERT(char(36),ValidationKey)

  FROM db_AvesChoir.dbo.avtActionForm_Reports
  WHERE ModuleID = 1037
   ORDER BY ReportEntryId desc

This query could be improved by including some data from the form submission, like a name of the person submitting the form. That data is stored in the record in an xml format.
 

Move Pop-Up Form title Left of X

Mark Buelsing 0 6 Article rating: No rating

Action Form, the pop-up form title shows in the wrong place, to the right of the X to close the form. Use this script to move the text to the left. Put it in the initialization Scripts in the form settings.

 

$('.modal-header h4').insertBefore($('.modal-header button'));

Push a Grid Selection to a Form

Mark Buelsing 0 11 Article rating: No rating

You can pop up a grid that will display records to choose from and then take the values from the chosen row and put them into the fiels on the form. This is a multiple column drop-down list box.

(Something that I have asked for in the past)

Use the following JS to move the field data from the grid to the form

/* Insert the module id of your FORM in the line below */

var module = '#dnn458root';

 

/* Use your form field names on the left side, and values from your grid row on the right */

angular.element($(module)).scope().form.fields.FirstName.value = '[FirstName]';

angular.element($(module)).scope().form.fields.LastName.value = '[LastName]';

angular.element($(module)).scope().form.fields.Email.value = '[Email]';

/* Trigger the form to update by applying the field changes */

angular.element($(module)).scope().$apply();

See a nice video that demonstrates building the popup components here: https://www.youtube.com/watch?v=hw_zY1Vdp14&list=PL67RlTAxc73HwiL13W1nvYZ_Wgb2jhWwd&index=4

 

HasRole SP

Mark Buelsing 0 0 Article rating: No rating

This stored procedure will return true or false after testing that a userid is in a given role

 

USE [DatabaseName]
GO
/****** Object:  StoredProcedure [dbo].[_LIS_ListArticlesCB]    Script Date: 8/12/2020 8:37:29 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO


CREATE procedure [dbo].[_LIS_HasRole]

    @UserID int 
    ,@RoleName nvarchar(150) 

AS


    --DECLARE @UserID int = 1
    --DECLARE @RoleName nvarchar(150) = 'Administrators'


    SELECT CAST(CASE WHEN COUNT(*) > 0 THEN 'True' ELSE 'False' END AS nvarchar(10)) AS HasRole
    FROM UserRoles INNER JOIN
    Roles ON UserRoles.RoleID = Roles.RoleID INNER JOIN
    Users ON UserRoles.UserID = Users.UserID
    WHERE Roles.Rolename IN (@RoleName, 'Administrators') AND Users.UserID = @UserID
 

Remove the ActionGrid URL Parameters

Mark Buelsing 0 0 Article rating: No rating

ActionGrid adds parameters to the URL for Page settings even when paging is turned off and not needed. I like those parameters to not be in the URL. This script can be used to clean up the URL. Be careful though, this removes all URL parameters, so if there are parameters needed for something else on the page, don't use this.

 

setTimeout(function (){ history.pushState(null, null, 'dashboard');}, 5000);

You can put the script in the ActionGrid module settings, Advanced UI Settings, On Init Javascript

RSS
12345

Welcome Photographers!

We would like to make connections with amateur photographers who would like to see their beautiful images used on the Internet.

If you are interested, leave your name and email and we'll contact you when a particular photo is needed for one of our website projects. If you have a photo that fits the need, then send it to us. At the very least, you will get credit for the photo. Some projects will pay for your photo. It is an opportunity to get your work published!

Thank you

Mark Buelsing