Reply To: SUCCESS message, Conditional Select option

Home Forums Quform PHP SUCCESS message, Conditional Select option Reply To: SUCCESS message, Conditional Select option

#32783
dubiousa
Participant

Hi Ally, yes you are right. Sadly i have started with the index.html you provide and as NOT knowing the “quform-elements” are being used for this i deleted the div 😀
Perhaps a comment:
// this div is used for ajax success output
would be nice in the provided index.html

Thanks!

Also, do not want to create yet another thread, but for everybody looking for CONDITIONAL logic, here is a simple VANILLA js for hiding options in select in condition from another select:


document.addEventListener('input', function (event) {
	if (event.target.id !== 'firstSelectId') return;
	let firstSelectVariable = event.target.value;
	console.log(firstSelectVariable);

	var optionsSecondSelect = document.getElementsByClassName('SecondSelectClassName');
	for (var i = 0; i < optionsSecondSelect.length; i++) {
        if (optionsSecondSelect[i].className.includes(firstSelectVariable)) { 
              //console.log("I see the dead people");
			  optionsSecondSelect[i].style.display = "block";
		}
		else { 
			  optionsSecondSelect[i].style.display = "none";
		}
	}
}, false);

For this to work the options in second select have to have a
class=”SecondSelectClassName firstSelectVariable”
with “SecondSelectClassName” static
and “firstSelectVariable” to be filtered after!

  • This reply was modified 2 weeks, 6 days ago by dubiousa.
Be inspired. © 2020 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy