How to make some variables editable while entering data in single line text variable?

Ashwini Jadhao
Giga Guru

Hi Community,

Is there a way to make variable read only when I enter a data in single line text variable.

For example,

Single line text variable: Provide Code : Entered string length is 17 character.

when I add 17 character value in Provide code then Description variable should be editable.Right now description is a Readonly type

 

1 ACCEPTED SOLUTION

Hitoshi Ozawa
Giga Sage
Giga Sage

Hi SnowDev,

To make field "Provide Code" have max length of 17 characters, set Variable attribute to "max_length=17".

find_real_file.png

 To make Description field editable when Provide Code is 17 characters, create a onChange client script.

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        g_form.setReadOnly('description', true); // set to readonly as default
        return;
    }

    if (newValue.length == 17) {
        g_form.setReadOnly('description', false);  // make description field editable only when provide_code is 17 characters
    } else {
        g_form.setReadOnly('description', true);
    }
}

Execution result:

case 1: Provide code is less than 17 characters.

find_real_file.png

case 2: Provide code is 17 characters.

find_real_file.png

 

View solution in original post

7 REPLIES 7

Hi snowDEV,

I don't think is there any way that other field(in your case description ) will impact based on the the entering data. because on this scenario no script or UI policy will run. 

You need to confirm with your customer. Without using any client script there is no OOB method to achieve this.

 

Mark it helpful if it helped you.

 

Thanks and regards

Anand 

To check length of characters as they are being entered would require DOM manipulation.

It's not too recommended but adding onkeyup() function to input element would make it possible to dynamically count number of characters that were entered.

If this is just for Service Portal, a widget maybe clone to add this functionality.

Ashwini Jadhao
Giga Guru

Thank you Anand