Datafeedr Support Forums

Datafeedr Support Forums (/index.php)
-   Problems (/forumdisplay.php?f=68)
-   -   Dropdown boxes behaving strangely on Chrome (/showthread.php?t=3862)

ayorofrance February 4th, 2011 12:16 PM

Dropdown boxes behaving strangely on Chrome
 
Hi Eric,

In my shop 30208 I am trying to use dropdown boxes instead of UL lists due to the number of items in the filters.

I thought I'd set it all up all right - it works fine in Firefox... however I am seeing some strange behaviour on Chrome.

If I go to a category page and click one of the sort options both filter (Model and Price) dropdown boxes disappears.

If I select an item in one of the filters the other dropdown box disappears...

Would you have any idea what might be causing this?

Thanks!

Eric February 4th, 2011 12:56 PM

Hmm... I don't know...

If you remove onchange="this.form.submit()" from your forms, does it still disappear?

ayorofrance February 4th, 2011 03:46 PM

It appears that it is the code to retain other filters that Chrome does not like...

If I take out the lines in bold it works:
Code:

<?php
function search_price_value($word) {
    $word = strip_tags($word);
    return $word;
}
?>

<form method="get">
    <?php if (@$_GET['word']){ echo "<INPUT TYPE='HIDDEN' NAME='word' Value='".search_price_value($_GET['word'])."'"; } ?>
  <?php if (@$_GET['ppp']){ echo '<INPUT TYPE="HIDDEN" NAME="ppp" Value="'.search_price_value($_GET['ppp']).'"'; } ?>
  <?php if (@$_GET['sort']){ echo '<INPUT TYPE="HIDDEN" NAME="sort" Value="'.search_price_value($_GET['sort']).'"'; } ?>

  <select name="price" id='store_dropdown_box'>
<option value="1-50"<?php if (@$_GET['price']=='1-50') {echo ' selected="selected"';}?>>Moins de 50</option>
<option value="50-100"<?php if (@$_GET['price']=='50-100') {echo ' selected="selected"';}?>>50 ~ 100</option>
<option value="100-150"<?php if (@$_GET['price']=='100-150') {echo ' selected="selected"';}?>>100 ~ 150</option>
<option value="150-200"<?php if (@$_GET['price']=='150-200') {echo ' selected="selected"';}?>>150 ~ 200</option>
<option value="200-250"<?php if (@$_GET['price']=='200-250') {echo ' selected="selected"';}?>>200 ~ 250</option>
<option value="250-"<?php if (@$_GET['price']=='250-') {echo ' selected="selected"';}?>>Plus de 250</option>

    </select>
    <input type="submit" value="Go" class="dfsbmt" />
</form>
 
<?php if (@$_GET['price']) { ?>
  <p><a href="[server.url type='fullpage' query='-price']">[X] Remove Filter</a></p>
<?php } ?>

Is there another way of doing this?

By the way I think it is an error in the standard Sorting Template that it does not retain any other filters that might be set... have you already flagged this?

Cheers,

Anders

Eric February 4th, 2011 04:22 PM

The problem is you did not close your <input> tags. You basically had this:

<input type="hidden" name="word" value="' . search_price_value($_GET['word']) . '"

but it should be this:

<input type="hidden" name="word" value="' . search_price_value($_GET['word']) . '" />

HTML Code:

<?php
function search_price_value($word) {
    $word = strip_tags($word);
    return $word;
}
?>


<form method="get">
    <?php
   
    if (@$_GET['word']) {
            echo '<INPUT TYPE="HIDDEN" NAME="word" Value="' . search_price_value($_GET['word']) . '" />';
    }
   
    if (@$_GET['ppp']) {
            echo '<INPUT TYPE="HIDDEN" NAME="ppp" Value="' . search_price_value($_GET['ppp']) . '" />';
    }
   
    if (@$_GET['sort']) {
            echo '<INPUT TYPE="HIDDEN" NAME="sort" Value="' . search_price_value($_GET['sort']) . '" />';
    }
   
    ?>


  <select name="price" id='store_dropdown_box'>
<option value="1-50"<?php if (@$_GET['price']=='1-50') {echo ' selected="selected"';}?>>Moins de 50</option>
<option value="50-100"<?php if (@$_GET['price']=='50-100') {echo ' selected="selected"';}?>>50 ~ 100</option>
<option value="100-150"<?php if (@$_GET['price']=='100-150') {echo ' selected="selected"';}?>>100 ~ 150</option>
<option value="150-200"<?php if (@$_GET['price']=='150-200') {echo ' selected="selected"';}?>>150 ~ 200</option>
<option value="200-250"<?php if (@$_GET['price']=='200-250') {echo ' selected="selected"';}?>>200 ~ 250</option>
<option value="250-"<?php if (@$_GET['price']=='250-') {echo ' selected="selected"';}?>>Plus de 250</option>

    </select>
    <input type="submit" value="Go" class="dfsbmt" />
</form>
 
<?php if (@$_GET['price']) { ?>
  <p><a href="[server.url type='fullpage' query='-price']">[X] Remove Filter</a></p>
<?php } ?>


ayorofrance February 4th, 2011 07:50 PM

Oh, dear!

Well spotted :-)

Amazing how well code works when it is written correctly...

Thank you!


All times are GMT -5. The time now is 01:13 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.