Attribute for Multi Line Text Variable

abhishekmittal
Tera Contributor

Hi

Can we define attribute for multi line text variable ?

If yes, please explain me this..

Thanks in advance.

Regards,

Abhishek

7 REPLIES 7

shloke04
Kilo Patron

Hi,



Don't think so, Variable Attributes feature are supported for Multi Line Text Variables. if you need to have Attributes Validation like Max length or any other property, can be done via using DOM as explained below:



You can write an On Load Catalog Client Script as mentioned below for Reference where I am checking the Max Length a User can enter in the Multi Line Text Variable:



Script:



function onLoad() {



var i = document.getElementById('IO:4e92cf349f203100d8f8700c267fcfe4'); //variable name


i.maxLength = '10';


}



Similarly you can do for other Attributes you require.



Note: DOM is not recomended to use as a Best Practice as it can break in future Upgrades due to change in Element ID of the Variable you are using.



Hope this helps. Mark the answer as correct/helpful based on impact.



Regards,


Shloke


Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Thanks for your help.


This is working for normal catalog item page, but when I try it in Service Portal page it is not working.


As we know that DOM element method getElementById() does not work for Service portal. Please correct me if I am wrong.



Thanks and Regards,


Abhishek


ajay1234
Kilo Contributor

Hi Abhishek,


It is not possible.


Attributes field visible only to the following variable types: Reference, Lookup Multiple Choice, Lookup Select Box, List Collector, Single Line Text, Wide Single Line Text.


If you do not see the Variable attributes field, then enable the Show attributes when Type is One of Certain Values UI policy.


But still you can't set the attribute value because this value are not applicable with Multi line Text.


you can set the limit using catalog client script.


You can use wide line text then it applicable.



Thank you!