Client UI policy not working

Community Alums
Not applicable

Fields:

Amount - type Text - Single-line - text validation number

additional question - Drop down options

 

Requirement - if the value is greater than 2500 then the additional question should be visible

 

What i have done:

initially additional question is hidden

behaviour for additional question - 

condition - amount greater than or is 2501 then 

action - make question visible yes, make question mandatory yes, value clear value

 

Behaviour:

when i enter 2501 it is working as expected additional box is getting visible

but if i am entering 10000 it is not working

other tried methods:

i have also tried using client scripts but mandatory is reflecting but the visible status is not getting updated in UI. 

 

 

1 REPLY 1

Brian Lancaster
Tera Sage

Use a catalog client script instead. I think the issue is that you trying to compare a string to a number. So you have to use code to convert the string into a number.

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
		g_form.setVisible('vaible_name', false);
        return;
    }
    //Type appropriate comment here, and begin script below
    var Amount = parseInt(newValue);
    if (Amount > 2501) {
        g_form.setVisible('variable_name', true);
        g_form.setMandatory('variable_name', true);
    }
}