1. Overview

This document talks about how to validate interactive grid columns dynamically using JavaScript.

 

2. Technologies and Tools Used

The following technologies have been used to validate IG columns.

  • Oracle Apex
  • JavaScript

 

3. Use Case

Assume that there is a requirement to dynamically validate IG columns without page submitting.

 

4. Architecture

  1. To avoid typing Alphabet in a number field, The below code is used to restrict dynamically.

function isNumber(e) {

 

var n = $v(‘e’);

n = (n) ? n : window.event;

var charCode = (n.which) ? n.which : n.keyCode;

if (charCode > 31 && (charCode < 48 || charCode > 57)) {

addBlur();

apex.message.alert(‘Numbers 0-9 only allowed’, function(){

removeBlur();

});

 

return false;

 

}

return true;

}

 

 

  1. To convert from lowercase to uppercase dynamically when the user types letters in the field.

function fn_toUppercase(e)

{

 

var str = document.getElementById(e).value;

var uc = str.toUpperCase();

document.getElementById(e).value = uc;

 

}

 

 

  1. To validate entered number is float or not

function isFloat(e)

{

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

if (charCode == 46 && e.split(‘.’).length>1) {

addBlur();

apex.message.alert(‘Not a decimal Number’, function(){

removeBlur();

});

return false;

 

}

if (charCode != 46 && charCode > 31 && (charCode < 48 || charCode > 57))

 

{

addBlur();

apex.message.alert(‘Numbers 0-9 & (.) only allowed’, function(){

removeBlur();

});

return false;

 

 

}

return true;

 

}

 

Recent Posts

Start typing and press Enter to search