format licence number problem - lead zero

Avatar

Avatar

WhatCindy

Avatar

WhatCindy

WhatCindy

10-08-2015

Hi All,

I have tried to fix my coding but it is not successful. Please help.

when I open the for the errors message is displayed this rawValue = null;

this field allows enter numeric only - max: 24 digits, allow enter from 19 digits up to 24 digits.

exit event

if(this.rawValue.length==0)

this.rawValue.length=0;

 

if(this.rawValue.length!=0){

if (this.rawValue.length =="19")

 

  // cancel the change

  this.rawValue =this.rawValue +"00000" 

 

  else if (this.rawValue.length =="20")

 

  // cancel the change

  this.rawValue =this.rawValue +"0000" 

 

   else if (this.rawValue.length =="21")

 

  // cancel the change

  this.rawValue =this.rawValue +"000" 

 

   else if (this.rawValue.length =="22")

 

  // cancel the change

  this.rawValue =this.rawValue +"00" 

 

   else if (this.rawValue.length =="23")

 

  // cancel the change

  this.rawValue =this.rawValue +"0" 

validator.validateRollNumber(xfa.event)

//+++++++++++++++++++++++++++++++++++++++++++++++++++++++

//function from object script document

function validateRollNumber(evnt)

{

var pattern = /^[0-9]{19,24}$/;

  

if(evnt.target.rawValue!=null)

 

// if user's input does NOT match the pattern, display a validation message

if(!evnt.target.rawValue.match(pattern))

 

evnt.target.rawValue="";

}

Thanks,

Cindy

Accepted Solutions (0)

Answers (0)