I am trying to develop an online booking system which has different options for each course. When a course is selected a combobox opens where you choose the week that you want the course.
There is an validation function to ensure that certain fields are completed. If you need to go back to complete the form, the combobox is not visible.
Is there any way to make combobox visible?
html as follows
course 1
course 2
course 3
Select your course…
The combobox is lifted out of WordPress as follows:
<input type="hidden" name= "course1a" value="<?php echo $title;?>,<?php echo the_field('cost_of_course',$week1a); ?>" />
<select name="date1a" id="date1a">
<option value="">Select Week</option>
<?php
$categories =get_the_category($week1a);
foreach ($categories as $category) {
if($category->name !== '6 +')
if($category->name !== '7+')
if($category->name !== '8+')
if($category->name !== '9+')
if($category->name !== '10 +')
if($category->name !== '11+')
if($category->name !== 'All')
$option = '<option value="'.$category->cat_name.'">';
$option .= $category->cat_name;
$option .= '</option>';
echo $option;
}
?>
The javascript driving this is as follows:
function showWeek(str) {
if (str == "") {
document.getElementById("txtHint").innerHTML = "";
return;
} else {
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else {
// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("txtHint").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET","dates.php?week="+str,true);
xmlhttp.send();
}
}
Any thoughts on how we can make the dropdown show on hitting back button.
booking system can be seen at
https://www.chiswickcourses.co.uk/wp/online-booking/
Cheers
Ian