Variable attributes for max_length is not working

Prudhvi Raj4
Tera Guru

Hello Team,

I am setting a catalog item variable's max length is 50 characters but it's not working, the field still allow more than 50 characters. Please a way to fix it?

PrudhviRaj4_0-1674465086502.png

Thanks,

Prudhvi

 

1 ACCEPTED SOLUTION

Try this in onload client script

g_form.getControl('var_name').setAttribute('maxlength', 20);

 

 

View solution in original post

4 REPLIES 4

Basheer
Mega Sage

Hi @Prudhvi Raj4 ,

The max_length is only applicable to variables: Single-line text, Wide single-line text.

Did you opt for these variables or other variables.

If you've opted for other variables then it needs to be done via onchange client script.

 

 

I am using single line text only but not working

Try this in onload client script

g_form.getControl('var_name').setAttribute('maxlength', 20);

 

 

Hi, 

If use same code on the variable set it's giving me "JavaScript error" on the portal setAttribute is not supported on the variable set client scripts?

 

Thanks,

Prudhvi