close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Filter Search (just like on webassist products page)

Thread began 4/26/2012 9:48 am by Christopher West | Last modified 5/02/2012 4:41 pm by Christopher West | 3959 views | 14 replies |

Christopher WestCommunity Expert

Filter Search (just like on webassist products page)

Hi there, Im trying to get the same effect as on your page: dreamweaver-extensions/

where upon I can filter products using a select box and sort products using a select box - but been unsuccessful. What is the correct workflow to do both? as they dont use a button event so im assumning their using a onclick event.

would it be a simple case of using dataassist search and sort server behaviours and then just create a couple of select lists with onclick triggers?

Chris

Sign in to reply to this post

Jason ByrnesWebAssist

The extensions page just uses a standard data assist search and sort behavior there is a separate form for the filter and the sort select lists, and they are set to submit the form on change using javascript:

onChange="document.formName.submit();"

first get the search working with a standard form using a submit button, then add the onchange event to the select list to submit the form with out the submit button.

do the same for the sorting.

Sign in to reply to this post

Christopher WestCommunity Expert

Hi Jason, I got the sort and the search working on the page. but i cannot seem to get the search working without a button and same with the sort function.

The code I was using for the drop down menu was as follows:

<form method="post" name="sortform">
<select name="sortfield" id="select" onChange="document.sortfield.submit();">
<option value="../../account.php?page=manageproducts&sort=ProductPrice">Price</option>
</select>
</form>

any ideas why the above wouldnt work?

Chris

Sign in to reply to this post

Jason ByrnesWebAssist

<form method="post" name="sortform">


the name of the form is "sortform"

so the onChange code:
onChange="document.sortfield.submit();"


should be:
onChange="document.sortform.submit();"


the onchange code is telling the form to submit.

Sign in to reply to this post

Christopher WestCommunity Expert

Hi Jason, thanks again for the support. still not working though. I must be missing something else in the code. as it just doesnt do anything - I had thought already about using the form name on the onchange code.. from the code i showed before would there be anything else i need to add like a hidde form element or a hidden submit code or anything like that? im guessing its going to be so obvious once I know. but just cant see it.

Chris

Sign in to reply to this post

Jason ByrnesWebAssist

please send a copy of the p[age and a link where i can see the problem.

Sign in to reply to this post

Christopher WestCommunity Expert

Hi Jason, I just uploaded a modifyed version of page (the actual page was password restricted and using framebuilder plugin as links on the drop downs).

here is the testing URL: test.php

I have provided also regular text links for sort to demonstrate that I can get sort functionality working without drop downs. also its odd as the drop down sort seems to ONLY work if I "first" click on the regular price sort link text. but the sort drop down wont work unless you first click on that price text link. so something odde there.

and the search drop down dont work at all - but i know its not set up but i just a bit stuck on how to finish that as it was using the variable name "WADbSearch1" in the original submit button version of the page.

attaching the file as well

Attached Files
test.zip
Sign in to reply to this post

Jason ByrnesWebAssist

for the search form:

Change the name of the select list to ProductCategoryID

<select name="ProductCategoryID" class="input-med" id="ProductCategoryID" onChange="document.filterform.submit();">


and add a hidden element named WADbSearch1


for the sort form, the value of the options should be the name of the columns, instead of:
<option value="test.php?sort=ProductSKU" >SKU</option>


use:
<option value="ProductSKU" >SKU</option>


then set the method of the form to get:
<form method="get" name="sortform">

Sign in to reply to this post

Christopher WestCommunity Expert

still not working :(

here is the exact code for search:

<form action="../../account.php?page=manage-products" method="post" name="filterform"><input name="WADbSearch1" type="hidden">
<select name="ProductCategoryID" class="input-long" id="ProductCategoryID" onChange="document.filterform.submit();">
<?php
do {
?>
<option name="WADbSearch1" value="<?php echo $row_rsCategories['CategoryID']?>"<?php if (!(strcmp($row_rsCategories['CategoryID'], $row_allProducts['ProductCategoryID']))) {echo "selected=\"selected\"";} ?>><?php echo $row_rsCategories['CategoryName']?></option>
<?php
} while ($row_rsCategories = mysql_fetch_assoc($rsCategories));
$rows = mysql_num_rows($rsCategories);
if($rows > 0) {
mysql_data_seek($rsCategories, 0);
$row_rsCategories = mysql_fetch_assoc($rsCategories);
}
?>
</select>
</form>


------------------------------------------------------------------------------------
here is exact code for my sort:(not i added the "../../account.php?page=manage-products" as its part of my template to display the page.
------------------------------------------------------------------------------------

<form method="get" name="sortform">
<select name="sortfield" id="select" onChange="document.sortform.submit();">
<option value="../../account.php?page=manage-products&ProductSKU" >SKU</option>
<option value="../../account.php?page=manage-products&ProductName" >Name</option>
<option value="../../account.php?page=manage-products&ProductPrice" >Price</option>
<option value="../../account.php?page=manage-products&ProductStock" >Stock Level</option>
<option value="../../account.php?page=manage-products&ProductLive" >Live</option>
<option value="../../account.php?page=manage-products&ProductAvailable" >Availability</option>
<option value="../../account.php?page=manage-products&ProductPopularity" >Popularity</option>
</select>
</form>

Sign in to reply to this post

Jason ByrnesWebAssist

for the search form:

1) the WADbSearch1 need to have a value:

<input name="WADbSearch1" type="hidden" value="search">

2) the option element cannot have a name:
<option name="WADbSearch1" value="<?php echo $row_rsCategories['CategoryID']?>"<?php if (!(strcmp($row_rsCategories['CategoryID'], $row_allProducts['ProductCategoryID']))) {echo "selected=\"selected\"";} ?>><?php echo $row_rsCategories['CategoryName']?></option>

remove the name attribute from the option code

for the sort form:

the page name should not be part of the select list option, only the name of the column to sort:
<option value="ProductSKU" >SKU</option>

to pass the page=manage-products variable in a form that uses the get method, you need to use a hidden element:

<input name="page" type="hidden" value="manage-products">

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...