I am trying to make a quotation request contact form within WordPress Contact Form 7. Now I have multiple different divisions within my website for which a quotation request can be made. I want them all to lead to the same website to minimize work etc.
Now people can choose between 5 different checkboxes about the division for which they want a quotation. For each division I will need to ask 2 specific question to make it easier for myself to make the quotation but these question should only show up when that checkbox is ticked. I have done this using:
function myFunction() {
// Get the checkbox
var checkBox = document.getElementById("Propulsion and Stabilization");
// Get the output text
var text = document.getElementById("text");
// If the checkbox is checked, display the output text
if (checkBox.checked == true){
text.style.display = "block";
} else {
text.style.display = "none";
}
}
This is what I'm using in the contact form which will show "Ship Length" and a textbox when ticking the box.
<p id="text" style="display:none"><label> Ship Length
[text text-234]</p> </label>
When the box is ticked the "text" (questions) will appear perfectly fine. Now my question is how can I make the question that appears "Required" for the people to fill-in? I have tried just normally adding required after document.getElementById("text"); but for some reason I cannot get it to work. Any ideas?
Thanks! Before Ticking box Ticked box result