Show field msg

nameisnani
Mega Sage

Hi Team ,

 

can anyone please provide me the script for field msg 

 

when ever - Yes , data owner ....... is selected , field msg should display Please attach evidence or provide details in the description for the existing standing approval '

nameisnani_0-1730263833075.png

nameisnani_1-1730263909950.png

option backend value 

 

please provide me scirpt with output.

1 ACCEPTED SOLUTION

@nameisnani You didn't replace with variable name but with select text. Should be as below.

 

 

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }

    if (newValue === 'yes2') {
        g_form.showFieldMsg('does_the_request_owner_approval_not_required_as_standing_approval_in_place', 'Please attach evidence or provide details in the description for the existing standing approval', 'error');
    } else {
        g_form.hideFieldMsg('does_the_request_owner_approval_not_required_as_standing_approval_in_place', true);
    }
}

 

 

Make an onChange client script on variable "does_the_request_owner_approval_not_required_as_standing_approval_in_place"

."

HitoshiOzawa_0-1730267708884.png

 

Execution result.

HitoshiOzawa_1-1730267857232.png

 

View solution in original post

6 REPLIES 6

Tai Vu
Kilo Patron
Kilo Patron

Hi @nameisnani 

Give my OnChange client script a try to show and hide field message for your case.

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (isLoading || newValue === '') {
        return;
    }

    if (newValue === 'yes2') {
        g_form.showFieldMsg('<your_variable_name>', 'Please attach evidence or provide details in the description for the existing standing approval', 'error'); //replace your variable name
		return;
    }
	g_form.hideFieldMsg('<your_variable_name>', true); //replace your variable name

}

 

Cheers,

Tai Vu

Hi @Tai Vu 

 

I have replaced with my variable name , field msg is not showing .

 

nameisnani_0-1730267197724.png

 

nameisnani_1-1730267232067.png

 

@nameisnani You didn't replace with variable name but with select text. Should be as below.

 

 

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }

    if (newValue === 'yes2') {
        g_form.showFieldMsg('does_the_request_owner_approval_not_required_as_standing_approval_in_place', 'Please attach evidence or provide details in the description for the existing standing approval', 'error');
    } else {
        g_form.hideFieldMsg('does_the_request_owner_approval_not_required_as_standing_approval_in_place', true);
    }
}

 

 

Make an onChange client script on variable "does_the_request_owner_approval_not_required_as_standing_approval_in_place"

."

HitoshiOzawa_0-1730267708884.png

 

Execution result.

HitoshiOzawa_1-1730267857232.png

 

@nameisnani Please accept @Timi 's reply too because he did provide the answer first. I only filled in the variable name. It's now possible to select several answers and I think he deserves the credit too.