Monday, August 16, 2021

Webform Contact/Phone Number Allowed only numbers not text with below jquery code

 

Using the below code, the text field can be changed to allow only the numbers, use can't enter text only numbers will be allowed.

------------------------------------------------------------------

jQuery( document ).ready(function() {

  jQuery("#field-id-or-class").attr('onkeypress','return isNumberKey(event);');

});

function isNumberKey(evt)

{

  var charCode = (evt.which) ? evt.which : event.keyCode;

 console.log(charCode);

    if (charCode != 46 && charCode != 45 && charCode > 31

    && (charCode < 48 || charCode > 57))

     return false;


  return true;

}

After Web Form Summited Zip file auto download


jQUERY CODE

-------------------------

 jQuery(function() {

jQuery('a[data-auto-download]').each(function(){

var $this = jQuery(this);

setTimeout(function() {

window.location = $this.attr('href');

}, 2000);

});

});

The below HTML code should be placed in the place of success message to make the zip file auto downlaod. 

HTML CODE:

------------------------------

<a class="button" data-auto-download="" href="/download.zip">click here</a>

Friday, January 22, 2021

Disabling a Module via the Database in Drupal 8

 

1) In D7 you could do this in the systems table by setting the status to 0. In D8, however this is stored in the config table. You can edit the blob value in the data field for this result:

SELECT * FROM config WHERE name like '%.extension%';


2) Or here's the fast (but dirty) solution:

- Delete the module's folder from the file system (/modules/

- truncate table cache_config using below commands 

 ---------------------------------------------------------------------


TRUNCATE cache_config;

TRUNCATE cache_container;

TRUNCATE cache_data;

TRUNCATE cache_default;

TRUNCATE cache_discovery;

TRUNCATE cache_dynamic_page_cache;

TRUNCATE cache_entity;

TRUNCATE cache_menu;

TRUNCATE cache_render;

TRUNCATE cache_toolbar;