9 years ago
5
Topic

Dear All

In a form, i can easily setup a conditional state on any standard field, but I do not succeed if the field is the result of a computation:

I have 4 fields, a, b, c & d

a is an text input

b is an text input 

c is computed (option 5) = a*b

d is a free text that should be visible only if c=400

I setup (option 5) "d is visible when c is equal 400", BUT even if c=400 , d remains not visible

Anybody could help ?

Get a VIP membership
9 years ago
0
Level 1

Hi

Nobody has an idea ?

Thanks in advance

8 years ago
1
Level 1

Hi

Just a small up because it's important for me

Regards

1283 Posts
Bucklash
8 years ago
0
Level 2

Hi Navthink

I had a go today and I think you need to add your own javascript to the Field 'D'.

The computation does seem to stop the required result. 

If I made a conditional where D showed if C is filled by 400, then it shows, 

but if C is filled by a computation then D does not show. 

I have added some javascript as an example, but NEVER EVER trust my javascript as I am rubbish at it.
$( "#field_c" ).keyup(function(e) {
    var thisValue = $this.val(), wantedValue = '400';
    if (thisVal === wantedVal) {
        $('#field_d').addClass('visible');
    } else {
        $('#field_d').removeClass('visible');    
    }
};

Bucklash

8 years ago
1
Level 1

Hi bucklash

Thanks for your reply, and sorry for my late reply, in fact I believed my topic was forgotten

I think the problem come from the fact conditionnal tests are done before computation, and thus there is no value in C when I test it

Your solution doesn't work as it is, but perhaps could work by changing the event KeyUp with OnChange.

I will try tomorow

Regards

8 years ago
0
Level 2

Finally I put my conditional test with PHP width code pack using before storage. It works

But Anyway, I'like to know if there is an other way than JS or PH to achieve test on a computed field ?

Get a Book for SEBLOD