Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

format licence number problem - lead zero

WhatCindy
Level 2
Level 2

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

0 Replies