I have a dropdown menu for my categories:
<form action="<?php bloginfo('url'); ?>" method="get" id="catform">
<?php
$parent = get_cat_ID("Pictures");
$select = wp_dropdown_categories("child_of=".$parent."&hide_empty=0&orderby=name&echo=0&show_option_none=Select...");
$select = preg_replace("#<select([^>]*)>#", "<select$1 onchange='return this.form.submit()'>", $select);
echo $select;
?>
</form>
This automatically goes to the category page in question when an option is chosen.
This is working great, except for one minor detail...the default option.
I have a default option called Select...
, but what I didn't realize is when you choose that option something is returned. On normal pages, nothing seems to happen, but that's because Select...
is chosen by default. On the category page (category.php
), if you choose Select...
you get redirected to: http://myurl.com/?cat=-1.
Is there any way when someone chooses Select...
the page does not submit the form?
Thank you,
Josh
option_none_value
defaults to:-1
, so because I didn't declare this, that's why that's working that way...I'd still just like it to not do anything when chosen...is that possible?