JustAskVin Insights

Ideas for leading and building technology well.

Practical writing on delivery, architecture, CMS migrations, digital growth, and the decisions that shape strong web experiences.

Latest

Page 7 of recent writing

All insights home →

javascript

issue with submit form in ajax success response

Usually when we try to submit the form after ajax call on success response, the form does not’t get submitted. Like for example in below code:- $.ajax({ type : “POST”, url : “to/some/url”, data : { userName:userName, mobileNumber:mobileNumber, otp:otp }, dataType : “json”, success : function(data) { if(data.result == t

Jul 12, 2019

Read article

Drupal

Drupal 8 render block from node twig file

{{ drupal_entity(‘block’, ‘put your block id here’, check_access=false) }} check_access=false => This is to make check if the block is allowed to access by which kind of user; default is false, which allow the block to be displayed without any check.

Feb 23, 2019

Read article

CMS

How to search in specific content type in drupal 7

Suppose you have created a content type named as “testimonial”. Now the requirement is to for search for a value “hello” under field name “title” then you can do so by using the below query. Please make sure that you have the “Entity API” module enabled. $searchkeyword = $_REQUEST[‘keyword’]; $query = new EntityField

Aug 1, 2018

Read article

General

validate email id using jquery or javascript

function validateEmail(email) { var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,6})?$/; return emailReg.test(email); } Usage:- if(validateEmail(emailString)){ alert(‘Your email is valid’); } else{ alert(‘Your email is not valid! There should be atleast @ and one dot(.) present in it’); }

May 4, 2018

Read article

HTML

Validate date format mm/dd/yyyy in jquery or javascript

<script type=”text/javascript”> function isValideDate(datavalue){ var regexValidDate = /^(?:(0[1-9]|1[012])[\/.](0[1-9]|[12][0-9]|3[01])[\/.](19|20)[0-9]{2})$/; return regexValidDate.test(datavalue); } var dateToCheck = ’06/01/2011′, if(isValideDate(dateToCheck)){ alert(“Given date is valid as per the format of MM/dd/Y

Mar 8, 2018

Read article

HTML

Redirect to another page after a specific time interval

<html> <body> <h1>Welcome to my Website</h1> <h4 id=”msg”>You will be redirected to another page in 5 seconds!</h4> <script type=”text/javascript”> function countDown(i, callback) { callback = callback || function(){}; var int = setInterval(function() { //document.getElementById(“displayDiv”).innerHTML = “Number: ” + i

Jan 23, 2018

Read article