Print Page | Close Window

compare 2 items on page

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=20336
Printed Date: 29 March 2026 at 9:43am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: compare 2 items on page
Posted By: urko
Subject: compare 2 items on page
Date Posted: 16 June 2006 at 6:47pm
How could I compare two different items on a page?

Example:

Lets say you're at page where item under ID 5 is shown. Now you have a link "compare" which points you to a diffrerent page.

On that page on left side you'll have item under ID 5 displayed.
Now on the right side I would like that users select from a list the item which they'll compare to the item already shown on left side.

Im not exactly sure how should I do this.


-------------
Urko



Replies:
Posted By: dpyers
Date Posted: 16 June 2006 at 8:23pm
Most of the online stores seem to display a list of similar products with check-boxes so you select the items you want to compare. A compare button then takes you to a page with a table where each item is a column and the relative comparison points are laid out as rows.

In your case, where it's just being compared to one other item, I'd have the comparison drop-down list on the first page where the original item was shown. Selecting an item from the comparison box there would take you to the third page where the comparison table is laid out. The second page doesn't seem necesary to me.


-------------

Lead me not into temptation... I know the short cut, follow me.


Posted By: urko
Date Posted: 17 June 2006 at 7:02am
Thanks dpyers..
However I always get same ID for both items on compare page.
Tip would be great, how should I solve that.

Also I need to have to list to select from
Example:
list 1: Names of items
list 2: Colour of item

One more question though....
How should I write in recordset so that each user can add to his list only lets say 20 items?

and if they add 21st item they'll get javascript message.


-------------
Urko


Posted By: dpyers
Date Posted: 17 June 2006 at 3:36pm
Originally posted by urko urko wrote:

However I always get same ID for both items on compare page.
Tip would be great, how should I solve that.

That sounds like it may be a probelm with the data being passed to the compare page. I'd do the compare page as a formhandler for the drop-down on the first page. Include the original ID as a hidden field, and the ID you want to compare it to as another field. On the compare page, it might be easier to debug if you used a separate call to the db for each ID store the results in an array and build the comparison page from the array
Originally posted by urko urko wrote:

Also I need to have to list to select from
Example:
list 1: Names of items
list 2: Colour of item

Kind of depends upon how you need to have the two lists work.

If the user can select by Name OR by Color, just pass separate fields to the formhandler/compare page. The one that's populated determines how the db call is done.

If the User can select by Name AND by Color, it gets more comlocated depending upone wether or not all Names can have the same Colors to choose from of if each Name can have a different Color.

If all Names use the same set of Colors, just pass Color as an additional field to the formhandler/compare page.

If each name can have a different set of colors, you'll need to use javascript to polulate the color field based upon what's selected in the Name field. Validate the selection in the formhandler/compare page script.

Javascript is not reliable though. Many people have it disabled. so you may choose to set things up so when a Name is selected, the form is submitted and returns to itself with the color selection field populated from the DB.
Originally posted by urko urko wrote:


How should I write in recordset so that each user can add to his list only lets say 20 items?
and if they add 21st item they'll get javascript message.

See the note above about javascript not being a reliable tool for validation.
If your users are registered, add a table keyed by user id to maintain a users list.
If your're users are not registered, add the same table but key it to a cookie id.
You'll find yourself using that table a lot to pull reports about your users preferences.


-------------

Lead me not into temptation... I know the short cut, follow me.


Posted By: urko
Date Posted: 17 June 2006 at 4:46pm
I have fixed first part "same ID" and found good article on macromedia website about list menus ( relationship between two lists )...I just need to look at it a little bit more so i'll understand how this works... Wink

Quote See the note above about javascript not being a reliable tool for validation.
If your users are registered, add a table keyed by user id to maintain a users list.
If your're users are not registered, add the same table but key it to a cookie id.
You'll find yourself using that table a lot to pull reports about your users preferences.

Ok i'll try to avoid javascript.
Thing is, users must be logged in my forum in order to use its list...First I tried to change buddy list to mylist...i have posted in modification forum about that., but I have made my own version and it's working great...

All I was thinking is to limit the records per user, so that user could only add 20 items ....like the Private message stuff, where admin decide how many PM can user have in its inbox...If they fill its box, they need to delete 1 or more in order to add new one.
Db is working ok, relations are made correctly, i just dont know what should I write and where to limit Mylist feature to 20 records per user.




-------------
Urko


Posted By: urko
Date Posted: 20 June 2006 at 6:35pm
I have found an article explaining how to limit the records per user, but for some reason I get an error all the time Object required

<% 
strSQL = "SELECT COUNT (*) AS Author_ID from tblMylinks WHERE Author_ID = " & lngLoggedInUserID & ";"
setObjRS = objConnection.Execute("strSQL")

If objRS ("Author_ID") = 10 then
response.write ("My text.... ")
End if %>



M i missing something??

Thanks


-------------
Urko


Posted By: urko
Date Posted: 20 June 2006 at 7:22pm
I made it .

-------------
Urko


Posted By: MadDog
Date Posted: 20 June 2006 at 10:27pm
remove the quotes in:
objConnection.Execute("strSQL")

should be:


objConnection.Execute(strSQL)


-------------
http://www.iportalx.net" rel="nofollow">



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net