Set Readonly for a List Collector Catalog Variable?

ctu1
Giga Expert

Hi,

I can set Readonly for simple variables that originate from catalog requests in the resulting tasks by using a client script on the sc_task form with:


g_form.setReadonly('variables.my_variable',true);


This works fine with simple variables, e.g. when my_variable is of type "Single Line Text". However when it comes to a slushbucket type "List Collector", I am stuck.

How does one do that?
7 REPLIES 7

ctu1
Giga Expert

I found a client script solution that will disable all slush bucket selection variables with the help of SNCguru.com (as always, thanks Mark!):



function onLoad(){
var ve = $('variable_map').up('table');
ve.select('.slushselectmtm').each(function(elmt){
elmt.disabled = true;
});
}


This is very much sufficient for us.


I have a somewhat related question. I am building a catalog item with a list collector variable that references alm_hardware. What I'd like to do is have my client script automatically populate the assets that belong to the user making the request (another variable - just a reference to a sys_user record). That is, the list collector would show (in the right side of the list collector slushbucket) all the assets currently assigned to the requested_for user.

See screenshot for a visual of what I'm talking about.

I'm trying to make it such that if someone changes the 'User' variable, the "Assets to Move" List Collector gets updated.

Thanks in advance for any guidance.


Hi,



THanks for the code.. I am struggling with one requirement-



If Requestor is requesting the item then he can choose from the list collector but after submitting the form if he again tries to access the same item then that list collector should be disable for him



Please advice


Paula Cullen
Kilo Guru

The only problem with disabling the list collector is that if there are more entries selected on the left than can be displayed on the right, you can't scoll to see them.

I'm looking for the list collector to be read only but to allow scrolling. I have this on other types of variables too. This script was originally written by SNC and I've edited it to add the list collector variable type. Unfortunately, it's only working in Firefox and not in IE which is my company standard. Anyone see what I'm doing wrong here?

if (((elmt.tagName.toLowerCase() == 'textarea' || elmt.tagName.toLowerCase() == 'input') && (elmt.type.toLowerCase() == 'text')) || (elmt.tagName.toLowerCase() == '.slushselectmtm')) {
elmt.readOnly = true;
}


I've tried slushselectmtm with the period and without it.

Would appreciate any ideas!