close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

resetting a search

Thread began 2/03/2014 8:33 am by Jamie | Last modified 2/07/2014 9:20 am by Jason Byrnes | 855 views | 15 replies |

Jamie

resetting a search

Hey Jason

I have a page that filters sponsors based on their sponsor type. See attached page. The filter works fine and filters the list depedning on which category you choose from thje drop down. The problem I am having is that the rest is not resetting the list back to the complete list.

Any pointers gratefully received.

Cheers

Jamie

Sign in to reply to this post

Jason ByrnesWebAssist

your reset button is not a submit button, it is regular button that you are using javascript to reload the page with a URL variable:


<input name="SearchReset" class="btn" type="button" onclick="window.location.href='plugins/sponsor_results.php?reset=true'" value="Reset" style="width: 90px;" />



in the clear session behavor though, you are using a post element for the trigger:
if (isset($_POST["reset"]) || isset($_POST["reset"])){

it should be the GET element:
if (isset($_GET["reset"]) || isset($_GET["reset"])){


since clicking the button does not submit the form.

Sign in to reply to this post

Jamie

gotcha, thanks Jason works a treat now.

on the same page, how would I make the drop down itself show the actually category that is being filtered by?

Sign in to reply to this post

Jason ByrnesWebAssist

you would need to add a set session value behavior to the page to save the selected category, then select the list in design view, and click the dynamic button, in the set selected option, bind the session value.

Sign in to reply to this post

Jamie

I have done that (well, at least think I have done it) but the dropdown when filtered doesnt show which item it is filtered by

the code I have added is:

<?php
@session_start();
if(isset($_POST["WADbSearch1"])) {
$_SESSION["filterbycategory"] = "".$row_WADAsponsors['SponsorCategoryID'] ."";
}
?>


and

<table cellpadding="2" cellspacing="5" border="0">
<tr>
<td colspan="3"><h1>Filter Sponsors by category: </h1></td>
</tr>
<tr>
<td colspan="3"><select name="sponsorSearch">
<?php do { ?>
<option value="<?php echo $row_Categories['CategoryID']; ?>" selected="selected" <?php if (!(strcmp($row_WADAsponsors['SponsorID'],$row_Categories['CategoryID']))) {echo "selected=\"selected\"";} ?> <?php if (!(strcmp($row_Categories['CategoryID'], $row_WADAsponsors['SponsorCategoryID']))) {echo "selected=\"selected\"";} ?>><?php echo $row_Categories['CategoryName']; ?></option>
<?php } while ($row_Categories = mysql_fetch_assoc($Categories)); ?>
</select></td>
</tr>
<tr>
<td width="60"><input type="submit" class="btn" name="WADbSearch1" value="Submit" style="width: 90px;" />
<td width="96"><input name="SearchReset" class="btn" type="button" onclick="window.location.href='sponsor_results.php?reset=true'" value="Reset" style="width: 90px;" />
</tr>
</table>
Sign in to reply to this post

Jason ByrnesWebAssist

you have bound the session to the recordset.

you should bind it to the sponsorSearch form element instead.

Sign in to reply to this post

Jamie

changed it to

<select name="sponsorSearch">
<?php do { ?>
<option value="<?php echo $row_Categories['CategoryID']; ?>" selected="selected" <?php if (!(strcmp($row_Categories['CategoryID'], ((isset($_POST["sponsorSearch"]))?$_POST["sponsorSearch"]:"")))) {echo "selected=\"selected\"";} ?>><?php echo $row_Categories['CategoryName']; ?></option>
<?php } while ($row_Categories = mysql_fetch_assoc($Categories)); ?>
</select>



but still not showing the selected filter

Sign in to reply to this post

Jason ByrnesWebAssist

I wouldn't expect that to work. reset it back.

in the set session value behavior, you are using the recordset binding.

you should be using the sponsorSearch form element instead.

Sign in to reply to this post

Jamie

Sorry Jason, am clearly not getting this one right... have atatched a couple of screenshots.

1.png - I am not sure if I am adding the correct info to the set session window..

2.png - this is what I get when I try to bind the session value..

Sign in to reply to this post

Jason ByrnesWebAssist

you have the right session name and form element, but the trigger should be set to use the sponsorSearch form element.


in the server behaviors list, find the dynamic menu server behavior and double click it to make changes.

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...