Variable Attribute max length issue

Cupcake
Mega Guru

Good morning all,

        I have two things that I am trying to solve for:

1.         I am trying to set one of my catalog variable to a max length of 9. I've done this for other variables but it seems for some reason that it is not holding the max_length=9. Even though I               change the view to get to the variable attributes and I save it after I've entered the max length, the system is not holding what I've put in.

2.         Also is there a way to make that same variable ONLY 9 characters. Meaning the customer doesn't want any less than 9 characters or any more than 9 characters.

find_real_file.png

Thank you,

Karen

1 ACCEPTED SOLUTION

larstange
Mega Sage
  1. Try and add variable attributes as a column in the variables table on the parent catalog item and change the value through the table
  2. You have to enforce the 9 characters via an onChange / onSubmit client script where you display some sort of error if anything less than 9 character have been entered


E.g. an onSubmit CS:



var routing = g_form.getValue('dd_routing_number1');


if (routing.length != 9) {


alert('You must enter 9 characters');


return false;


}


View solution in original post

8 REPLIES 8

larstange
Mega Sage
  1. Try and add variable attributes as a column in the variables table on the parent catalog item and change the value through the table
  2. You have to enforce the 9 characters via an onChange / onSubmit client script where you display some sort of error if anything less than 9 character have been entered


E.g. an onSubmit CS:



var routing = g_form.getValue('dd_routing_number1');


if (routing.length != 9) {


alert('You must enter 9 characters');


return false;


}


Thank you this was very helpful.



As far as the max length, I figured that part out. For some reason I had to enter the max length in two places. When I only entered the max_length in the below variable attributes it wouldn't save it. That was strange, I never had to do that before. But none the less I figured it out.


find_real_file.png



Thank you ALL.



Karen


Hi Karen,



It looks like someone put the same field on your form in two different sections. The system has some safeguards in place to ensure this doesn't happen. However it could be a hold over from a previous release, or someone did the form layout using the legacy method (Form Layout instead of Form Design.)



Step 1: Verify they are the same field by doing a right-click on the field label and observe the value of the "Show field_name" option (e.g. Show attributes).


Step 2: if both are the same, use the form menu to select Configure> Form Design to remove which ever duplicate you don't want.



Form Design - ServiceNow Wiki


This is great stuff. Thank you - I learn something new each day.



I will keep you posted.



Karen