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

Push a Grid Selection to a Form

Mark Buelsing 0 2525 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 1512 Article rating: No rating

This script will return true or false after testing that a userid is in a given role or is superuser

 


SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO


CREATE procedure [dbo].[_LIS_HasRole]

    @UserID int 
    ,@RoleName nvarchar(150) 

AS

    DECLARE @CheckUserID int
    DECLARE @HitCount int = 0

    SET @CheckUserID = @UserID
    IF @CheckUserID <> 0 
    BEGIN
    --if user is superuser
    SET @HitCount = (SELECT IsSuperUser FROM Users WHERE UserID = @CheckUserID)

     -- if user is administrator
    SET @HitCount = @HitCount + (
    SELECT COUNT(*)
    FROM UserRoles INNER JOIN
    Roles ON UserRoles.RoleID = Roles.RoleID INNER JOIN
    Users ON UserRoles.UserID = Users.UserID
    WHERE Roles.Rolename = 'Administrators' AND Users.UserID = @CheckUserID)

    --is user in the queried role
    SET @HitCount = @HitCount + (
    SELECT COUNT(*)
    FROM UserRoles INNER JOIN
    Roles ON UserRoles.RoleID = Roles.RoleID INNER JOIN
    Users ON UserRoles.UserID = Users.UserID
    WHERE Roles.Rolename = @RoleName AND Users.UserID = @CheckUserID)

--return the answer

    SELECT CAST(CASE WHEN @HitCount > 0 THEN 'True' ELSE 'False' END AS nvarchar(10)) AS HasRole
END
ELSE
    SELECT 'False' AS HasRole

 

____________________________

 

Or if you need to make this determination without a stored procedure

 

   Two other ways to do this with SQL are in the article read more

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

More than Just Text

Mark Buelsing 0 3441 Article rating: No rating

When you make an announcement on your Home page, add something more than just the text. Optimally add an image or clipart to emphasize or just beautify the text. In the least, provide a title and format it differently than the announcement text below it. 

Remember if you format your announcement title, make sure you use consistent formatting to the other content on the page. Consistent formatting = Professionalism.

Remove blank from Multiple Choice

Mark Buelsing 0 0 Article rating: No rating

Multiple Choice fields have a blank entry in the list. I find that non-entry a confusing thing and don't want it there. It is usually the first item in the select list. You can remove it with code. Put a Static Text field on the form and paste the following JS. Change the ID's

 

<script>
// delete the blank entries in the combos
document.getElementById("dnn2244RTDecision1").options[0].remove();
document.getElementById("dnn2244RTDecision2").options[0].remove();
document.getElementById("dnn2244RTDecision3").options[0].remove();
document.getElementById("dnn2244RTDecision4").options[0].remove();
document.getElementById("dnn2244RTDecision5").options[0].remove();
</script>

 

******

A CSS:3 way to do this is to add the following style:

 option:empty{ display:none;} */Removes empty Multiple choice options /*

 

RSS
12345678