Field should we only Number in between 1-4094

Sirri
Tera Guru

Hi All,

 

In catalog item one field that is VLAN ID4 It should want to be only numbers. In that number is only from 1 to 4094.

 

If user enter more than that numbers error message should want display.

Please let me know how to achieve this requirement.

 

Thanks 

3 REPLIES 3

Pravindra1
Tera Guru

you can use OOTB validation regex option available under type specification tab to achieve it. 

Pravindra1_0-1715595020272.png

 

Hi @Pravindra1 ,

 

Please provide more clarity on this. Please provide the any documents or articles it will helpful to me.

 

Thanks

SAI VENKATESH
Tera Sage
Tera Sage

Hi @Sirri 

You can try the below code for on change client script and provide onchange field name as VLAN ID4

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (isLoading || newValue === '') {
        return;
    }
	if(isNaN(newValue) || newValue < 1 || newValue > 4094){
		g_form.clearValue('VLAN ID4'); // change to appropriate field name
		g_form.addErrorMessage("you need to enter values between 1 to 4094")
	}
}

 

Thanks and Regards

Sai Venkatesh