J
Jason C
I'm having a problem on my site that seems to ONLY occur when the user has a Blackberry. I have an iPhone and an Android, but no Blackberry, so naturally, I have no way of duplicating the problem.
This is on a classifieds page. The user will select a category from a SELECT menu, then if necessary, a second SELECT menu will pop up for a subcategory.
Further down the page, the user has a series of checkboxes, where they can select to show the listing under multiple sections of the site.
The problem, though, is that with Blackberry users, one of the values of the checkboxes (seemingly random) will come through as the value of the subcategory.
I've tried to duplicate this with IE, FF, Chrome, Safari, Opera, iPhone, and Android, with no luck. The only similarity between the submissions with errors is that the user is using a Blackberry, so I'm guessing that it's either something with the phone, or an error somewhere in the code that's onlybeing picked up by Blackberry.
FWIW, the page "almost" validates via W3.org. The only error that it finds is that I use <p></p> to let the user increase the font size of the page, but it's used within several inline tags. This should be irrelevant for thiserror, though.
The relevant code is below. Do you guys see a flaw anywhere that could be causing this?
// The JavaScript
//
// this is used later in the script, but I'm
// leaving it here in case it's somehow relevant
var has_subcat = false;
// Set subcategories
function getSubcat(cat) {
var list_cat = new Array();
var show_msg;
// Modified for this post
// The actual script creates several arrays, where the
// list_cat[index] represents a category (like "Autos"),
// and the values represent a subcategory (like "Cars")
list_cat['Autos'] = new Array (
"Cars",
"Trucks, Vans, and SUVs",
"Motorcycles / ATVs",
"Campers / Boats",
"Farm Equipment",
"Parts and Accessories"
);
if (cat && (list_cat[cat].length > 0)) {
has_subcat = true;
show_msg = "<select name='subcat' size='1'>";
show_msg += "<option value=''>Choose a subcategory<\/option>";
for (n=0; n < list_cat[cat].length; n++)
show_msg += "<option value='" + list_cat[cat][n] + "'>"
+ list_cat[cat][n] + "<\/option>";
show_msg += "<\/select>";
}
if (document.getElementById)
document.getElementById('subcategory').innerHTML = show_msg;
else if (document.all)
document.all[subcategory].innerHTML = show_msg;
else if (document.layers) {
document.layers[subcategory].document.write(show_msg);
document.layers[subcategory].document.close();
}
}
// The HTML part of the SELECT menu
<select name="category" size="1" onChange="getSubcat(this.value)">
<option value="">Choose a Category...</option>
// Abbreviated for this post. Several options are
// usually shown here
<option value="Autos">Autos</option>
</select>
<div id="subcategory"></div>
// The HTML part of the checkboxes; roughly 40 of these
// are actually shown
// "option" is intended as a variable here, so the
// live page doesn't actually say "option"
<div style="float:left">
<input type="checkbox" name="more" id="option" value="option">
Option
</div>
This is on a classifieds page. The user will select a category from a SELECT menu, then if necessary, a second SELECT menu will pop up for a subcategory.
Further down the page, the user has a series of checkboxes, where they can select to show the listing under multiple sections of the site.
The problem, though, is that with Blackberry users, one of the values of the checkboxes (seemingly random) will come through as the value of the subcategory.
I've tried to duplicate this with IE, FF, Chrome, Safari, Opera, iPhone, and Android, with no luck. The only similarity between the submissions with errors is that the user is using a Blackberry, so I'm guessing that it's either something with the phone, or an error somewhere in the code that's onlybeing picked up by Blackberry.
FWIW, the page "almost" validates via W3.org. The only error that it finds is that I use <p></p> to let the user increase the font size of the page, but it's used within several inline tags. This should be irrelevant for thiserror, though.
The relevant code is below. Do you guys see a flaw anywhere that could be causing this?
// The JavaScript
//
// this is used later in the script, but I'm
// leaving it here in case it's somehow relevant
var has_subcat = false;
// Set subcategories
function getSubcat(cat) {
var list_cat = new Array();
var show_msg;
// Modified for this post
// The actual script creates several arrays, where the
// list_cat[index] represents a category (like "Autos"),
// and the values represent a subcategory (like "Cars")
list_cat['Autos'] = new Array (
"Cars",
"Trucks, Vans, and SUVs",
"Motorcycles / ATVs",
"Campers / Boats",
"Farm Equipment",
"Parts and Accessories"
);
if (cat && (list_cat[cat].length > 0)) {
has_subcat = true;
show_msg = "<select name='subcat' size='1'>";
show_msg += "<option value=''>Choose a subcategory<\/option>";
for (n=0; n < list_cat[cat].length; n++)
show_msg += "<option value='" + list_cat[cat][n] + "'>"
+ list_cat[cat][n] + "<\/option>";
show_msg += "<\/select>";
}
if (document.getElementById)
document.getElementById('subcategory').innerHTML = show_msg;
else if (document.all)
document.all[subcategory].innerHTML = show_msg;
else if (document.layers) {
document.layers[subcategory].document.write(show_msg);
document.layers[subcategory].document.close();
}
}
// The HTML part of the SELECT menu
<select name="category" size="1" onChange="getSubcat(this.value)">
<option value="">Choose a Category...</option>
// Abbreviated for this post. Several options are
// usually shown here
<option value="Autos">Autos</option>
</select>
<div id="subcategory"></div>
// The HTML part of the checkboxes; roughly 40 of these
// are actually shown
// "option" is intended as a variable here, so the
// live page doesn't actually say "option"
<div style="float:left">
<input type="checkbox" name="more" id="option" value="option">
Option
</div>