zegmis
New Member
Hi Lads,
read a lot about element show/hide functionality and found two great posts
http://fabrikar.com/forums/index.ph...script-code-to-hide-or-show-an-element.30911/
and
http://fabrikar.com/forums/index.ph...ity-of-a-googlemap-element.27260/#post-145919
now based on those i want to write a JS code to show/hide elements based on selected value - usual stuff.
Options to select:
Please select
1
0
so in question 1 (newinjury_table___new_injury_Q1) i have
1. 'On load' action to hide Question 2
This action works ok - element is hidden when form is loaded.
2. 'on change' action to show/hide question 2 based on question 1 selection
and here nothing happens when question 1 values are changed. Can anybody advise please what i am doing wrong?
Thanks,
Paul
read a lot about element show/hide functionality and found two great posts
http://fabrikar.com/forums/index.ph...script-code-to-hide-or-show-an-element.30911/
and
http://fabrikar.com/forums/index.ph...ity-of-a-googlemap-element.27260/#post-145919
now based on those i want to write a JS code to show/hide elements based on selected value - usual stuff.
Options to select:
Please select
1
0
so in question 1 (newinjury_table___new_injury_Q1) i have
1. 'On load' action to hide Question 2
PHP:
var q2 = document.getElementById('newinjury_table___new_injury_Q2').findClassUp('fabrikElementContainer');
q2.hide();
2. 'on change' action to show/hide question 2 based on question 1 selection
PHP:
var test = form_10.formElements.get('newinjury_table___new_injury_Q1').getValue();
var q2 = document.getElementById('newinjury_table___new_injury_Q2').findClassUp('fabrikElementContainer');
if(test == 1) {
q2.show();
}
else {
q2.hide();
}
Thanks,
Paul