Need client script
						
					
					
				
			
		
	
			
	
	
	
	
	
Options
			
				
					
	
			
		
	- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
‎01-18-2024 07:40 AM
For a variable (number) - it should accept only whole number ex:12 after that it need to autopopulate as ($12.00) including decimal and dollar symbol.
If alphabets or or any other apart from whole numbers are entered then it should show error.
		6 REPLIES 6
	
		
		
			
			
			
					
	
			Options
			
				
					
	
			
		
	- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
‎01-18-2024 07:52 AM
Hi,
Try below
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (isLoading || newValue == '') {
     return;
  }
var regexp =/^\d+$/;
  if(!regexp.test(newValue))
  {
 alert('Please enter Numbers. Only numbers are allowed');
  g_form.setValue('your_field_name',''); //replace your_field_name with field or variable name
  }
else
{
var setdollar='$';
var setdecimal='.00';
var valueenteredis=newValue;
var finalvalueis=setdollar+newValue+valueenteredis;
g_form.setValue('your_field_name',finalvalueis); //replace your_field_name with field or variable name
}
}
					
				
			
			
				
			
			
				
			
			
			
			
			
			
		Options
			
				
					
	
			
		
	- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
‎01-18-2024 08:06 AM
Options
			
				
					
	
			
		
	- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
‎01-18-2024 08:14 AM
Replace
if(!regexp.test(newValue))
with
if(regexp.test(newValue))
					
				
			
			
				
			
			
				
			
			
			
			
			
			
		Options
			
				
					
	
			
		
	- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
‎01-18-2024 08:37 AM
Still it's not working
