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

Javascript & JQuery

Open Form in Popup With Querystring Parametes

Mark Buelsing 0 14 Article rating: No rating

Using the javascript API you can open Action Form in popup by calling the next javascript method

dnnsf.api.actionForm.openPopupById(‘1234’, {‘param’:’valueofparam’,’param2’:’valueofparam2’},true)

Reload page but keep scroll position

Mark Buelsing 0 54 Article rating: No rating

// to restore the scroll position after re initialize use this JS

<script>
document.addEventListener("DOMContentLoaded", function(event) { 
  var scrollpos = localStorage.getItem('scrollpos');
     if (scrollpos) window.scrollTo(0, scrollpos);
   });

 window.onbeforeunload = function(e) {
   localStorage.setItem('scrollpos', window.scrollY);
  };

</script>

Remove ActionGrid Page Numbers from QueryString

Mark Buelsing 0 152 Article rating: No rating

 

 

This will remove the page numbers from the querystring. But as it is, it sometimes causes the page to reload. Thi example sets what it wants the querystring to be.


    setTimeout(function () {
        window.history.pushState({}, document.title, "/" + 'book/BID/1' );}
    ,2000);
    setTimeout(function () {
        window.history.pushState({}, document.title, "/" + 'book/BID/1' );}
    ,3000);

 

Move Pop-Up Form title Left of X

Mark Buelsing 0 143 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 156 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

 

RSS
123