If the user changes the value of the Category field,  set the default value for the Subcategory
						
					
					
				
			
		
	
			
	
	
	
	
	
Options
			
				
					
	
			
		
	- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
10-05-2024 04:46 AM
 If the user changes the value of the "Category" field,
 set the default value for the "Subcategory" field
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
   if (isLoading || newValue === '') {
      return;
   }
   if(newValue=='Software'){
    g_form.setValue('subcategory','OS Issues');
   }
   else if(newValue=="Hardware"){
    g_form.setValue('subcategory','Laptop issues');
   }
   else{
    g_form.clearValue('subcategory');
   }
   //Type appropriate comment here, and begin script below
}
above script is not wokring why?
can anyone help me
					
				
			
			
				
			
			
				
			
			
			
			
			
			
		above script is not wokring why?
can anyone help me
		1 REPLY 1
	
		
		
			
			
			
					
	
			Options
			
				
					
	
			
		
	- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
10-05-2024 11:02 PM
Hi @desaiakash0 ,
The script is looking good but please check the below points:
1. Check if you selected the correct "Field name" in the onchange client script.
2. Please check if the values of the choices are correct or not, we need to use the value of the choices instead of the label.
3. Please check the field name of the subcategory field.
If this solution helps you then, mark it as accepted solution ✔️ and give thumbs up 👍!
