Menu

Solutions to Problems or Custom Needs in a Website

Many solutions we create for one site can be used and appreciated on other sites also.

Have a look at this list of components and solutions we have developed over time and if you could benefit from any of them you are welcome to them.

Please let us know if you would like to discuss the details or would like some help getting one installed.

Prevent a Form Submit

Mark Buelsing 0 0 Article rating: No rating

To prevent a page refresh you have 3 options:

If you are working with a button.

1. return false  - on change/click  - which will stop execution of all actions on the button (as the on change/click javascript executes first)

2. return false; - but move it from the on change/click area to an Execute JavaScript action which you place as the last action on the submit button

3. Update Form AJAX as the last action on the button; this will submit and then refresh your form without refreshing the page.

Open Form in Popup With Querystring Parameters

Mark Buelsing 0 1284 Article rating: 5.0

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 1102 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 1278 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 1301 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'));

RSS
1234
RSS
1234