Display text field based on conditional logic

[ad_1]

Hi, could anyone tell me what is the simplest way to display a text field based on more complex conditional logic? I can easily do it based on one variable, for example a selection from a dropdown by using ‘If selected show fieldname7’. However, I have messages which I need to display depending on more complex logic than that. For example

(function(){
if (fieldname4 == “Bay Window bus” && (fieldname6 == “1968” || fieldname6 == “1969” || fieldname6 == “1970” || fieldname6 == “1971”)) some code to make a text field appear;
})()

I am not sure whether there is a feature built in to do this, which I have not found, or whether it should somehow be done by

I am using this for data validation – to prevent users entering invalid combinations from multiple dropdowns.
I believe a message can probably be inserted based on conditional logic by inserting HTML somehow, but controlling the display of a text field suits my requirement better. Some of the messages I would like to display are quite long (they explain to the user why what they have selected is invalid), so I would ideally like to use the conditional logic to display whether a text field displays or not because of how they can be made to appear a 2 lines with scroll arrows, to a long message doesn’t take up lots of space.
I have searched this forum, and scrolled through 35 pages of it, but not found anything directly relevant. Thank you.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer