• Toll-free  888-665-8637
  • International  +1 717-220-0012
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

2 Pages12>
[email protected]
#1 Posted : Thursday, August 30, 2007 4:04:20 PM(UTC)
everett@bvsoftware.com

Rank: Member

Joined: 3/8/2007(UTC)
Posts: 139

Hi Everybody,

Recently a user inquired about a "non-table" based image radio button list so that they could easily position their product choices. Attached to this thread is an archive with some updated files that will help you do this. Extract the files and folder to your "SiteRoot\BVModules\ProductChoices\" folder. Do not overwrite your existing image radio button list, just add this as an alternative. There are some extra styles that you will want to add to your style sheet. I have added some examples in a text file in the archive.

I hope this helps!

Thanks,
[email protected] attached the following image(s):
HorizontalChoices.jpg (20kb) downloaded 174 time(s).

You cannot view/download attachments. Try to login or register.
Everett Comstock

BV Software
memikhail
#2 Posted : Thursday, August 30, 2007 4:24:00 PM(UTC)
memikhail

Rank: Member

Joined: 2/18/2006(UTC)
Posts: 172

Everett,

What files/folder should we overwrite. Currently we have 3 folders:

1. Drop Down List
2. Image Radio Button List
3. Radio Button List

Thank you.
Cliff
#3 Posted : Thursday, August 30, 2007 5:18:43 PM(UTC)
Cliff

Rank: Member

Joined: 5/24/2004(UTC)
Posts: 4,147

You wouldn't necessarily overwrite, you would just add it as a new option in a new folder. Unless you want to automatically apply it to all of the products already set to use the standard image radio button list, and in that case you should be able to overwrite them (haven't tested it).

Everett, are the images properly treated as labels so the options are selected when the images are clicked? I noticed that the table-based display module doesn't.
memikhail
#4 Posted : Thursday, August 30, 2007 5:27:52 PM(UTC)
memikhail

Rank: Member

Joined: 2/18/2006(UTC)
Posts: 172

Should I just create a new folder with the xxx name and have all new files in?
Cliff
#5 Posted : Thursday, August 30, 2007 5:40:07 PM(UTC)
Cliff

Rank: Member

Joined: 5/24/2004(UTC)
Posts: 4,147

Yep, the name of the zip file (CSS Image Radio Button List) would be ideal.
MitchA
#6 Posted : Thursday, August 30, 2007 7:31:00 PM(UTC)
MitchA

Rank: Member

Joined: 3/3/2006(UTC)
Posts: 1,737

How would this affect anyone using radioButton.Text = choiceOption.DisplayText.ToString in View.aspx.vb?

How would you place the text below the buttons?


If you have many choices or large images (say,8) will the list wrap (5 top line, 3 bottom line all centered - default?), or stack (4 top line, 4 bottom line)? Some pages are quite narrow.

http://forums.bvcommerce...spx?f=79&m=46054
Optimists invent airplanes,
Pessimists buy parachutes.
[email protected]
#7 Posted : Friday, August 31, 2007 3:39:54 PM(UTC)
everett@bvsoftware.com

Rank: Member

Joined: 3/8/2007(UTC)
Posts: 139

Hey Cliff,

In regard to "are the images properly treated as labels so the options are selected when the images are clicked?". No they are not. But I will modify it so that the images will output as labels.

And Mitch.... I'll see about getting the label names in there too!

Thanks,
Everett Comstock

BV Software
[email protected]
#8 Posted : Friday, August 31, 2007 4:17:15 PM(UTC)
everett@bvsoftware.com

Rank: Member

Joined: 3/8/2007(UTC)
Posts: 139

Hey Cliff,

This may be a little more difficult than expected. Adding the image to a label and getting the radio button to respond to its respective image was easy. However, it looks like Anthem may be responding to the "on-click" event opposed to the "on-focus" event, so it may be difficult to get all the parts in working order without having to seriously modify the code. I'll keep investigating though.

And Mitch, if you want labels then add this line of code after
"AddHandler radioButton.CheckedChanged, AddressOf RadioButton_CheckedChanged" :

radioButton.Text = choiceOption.DisplayText.ToString

Thanks,
Everett Comstock

BV Software
[email protected]
#9 Posted : Friday, August 31, 2007 4:19:30 PM(UTC)
everett@bvsoftware.com

Rank: Member

Joined: 3/8/2007(UTC)
Posts: 139

Hi Mitch,

I didn't read your post as closely as I should have. The extra code will not affect the functionality of the page. It will only affect the display and layout of the radio buttons.

Thanks,
Everett Comstock

BV Software
Cliff
#10 Posted : Friday, August 31, 2007 4:45:26 PM(UTC)
Cliff

Rank: Member

Joined: 5/24/2004(UTC)
Posts: 4,147

Thanks, Everett. An overall audit of labels that should be label tags throughout the app would be a great addition to SP3.
Cliff
#11 Posted : Thursday, September 6, 2007 6:17:24 PM(UTC)
Cliff

Rank: Member

Joined: 5/24/2004(UTC)
Posts: 4,147

Originally Posted by: "Everett" Go to Quoted Post
This may be a little more difficult than expected. Adding the image to a label and getting the radio button to respond to its respective image was easy. However, it looks like Anthem may be responding to the "on-click" event opposed to the "on-focus" event, so it may be difficult to get all the parts in working order without having to seriously modify the code. I'll keep investigating though.


Everett, do you have this working with Anthem? Even without adding the labels, I can't get it to change the main image or title when an option is selected.
Andy Miller
#12 Posted : Thursday, September 6, 2007 6:20:01 PM(UTC)
Andy Miller

Rank: Member

Joined: 11/5/2003(UTC)
Posts: 2,136

Was thanked: 1 time(s) in 1 post(s)
Cliff, are you using the control Everett posted? Unmodified?
Andy Miller
Structured Solutions

Shipper 3 - High Velocity Shipment Processing
Cliff
#13 Posted : Thursday, September 6, 2007 7:48:24 PM(UTC)
Cliff

Rank: Member

Joined: 5/24/2004(UTC)
Posts: 4,147

Yeah. Actually, something else must be going on here with my setup. Suddenly, none of my local sites are doing the anthem dance. No clue what's going on, I don't think anything has changed...
Andy Miller
#14 Posted : Thursday, September 6, 2007 8:41:52 PM(UTC)
Andy Miller

Rank: Member

Joined: 11/5/2003(UTC)
Posts: 2,136

Was thanked: 1 time(s) in 1 post(s)
Try adding this small script to a page. It will display an alert if there is a server error,

Code:

<script[b][/b] type="text/javascript[b][/b][b][/b]">
function Anthem_Error(result) {
alert[b][/b](result.error);
}
</script[b][/b]>

Andy Miller
Structured Solutions

Shipper 3 - High Velocity Shipment Processing
Cliff
#15 Posted : Thursday, September 6, 2007 8:47:52 PM(UTC)
Cliff

Rank: Member

Joined: 5/24/2004(UTC)
Posts: 4,147

Yeah, the alert comes up with "BADRESPONSE" when one of the radio button items is clicked.
Cliff
#16 Posted : Thursday, September 6, 2007 10:35:15 PM(UTC)
Cliff

Rank: Member

Joined: 5/24/2004(UTC)
Posts: 4,147

OK, turns out that some beta Visual Studio stuff I installed the other day was the culprit. I did a system restore in Vista and Anthem is working again (though the state of some apps after the restore is kind of scary).

Andy, I have the label tags in place, but Anthem isn't responding (other than flashing the main product image). Any ideas why?
Cliff
#17 Posted : Friday, September 7, 2007 2:11:01 AM(UTC)
Cliff

Rank: Member

Joined: 5/24/2004(UTC)
Posts: 4,147

I think I've figured it out. I used an Anthem.label instead of manually creating a 'label' tag with a 'for' attribute. The 'AssociatedControlID' attribute automatically creates the 'label' tag.

For this example, I have the options in an unordered list.

View.aspx snippet:
Code:

<ul id="radioButtonList" runat="server"></ul>


View.aspx.vb snippet:
Code:

For Each choiceOption As Catalog.ProductChoiceOption In choice.ChoiceOptions
Dim optionSettingsManager As New Datalayer.ComponentSettingsManager(choiceOption.Bvin)
Dim li As New UI.HtmlControls.HtmlGenericControl("li")

Dim radioButton As New Anthem.RadioButton()
radioButton.AutoCallBack = True
radioButton.GroupName = Me.BlockId
radioButton.ID = choiceOption.Bvin
If choiceOption.IsDefault Then
radioButton.Checked = True
Else
radioButton.Checked = False
End If

If choiceOption.IsNull Then
Me.NullValue = choiceOption.Bvin
End If
AddHandler radioButton.CheckedChanged, AddressOf RadioButton_CheckedChanged
li.Controls.Add(radioButton)

Dim lbl As New Anthem.Label()
lbl.AssociatedControlID = radioButton.ClientID
lbl.ToolTip = choiceOption.DisplayText

Dim img As New Anthem.Image()
img.AlternateText = choiceOption.DisplayText
img.ImageUrl = Page.ResolveUrl("~/" & optionSettingsManager.GetSetting("ImageUrl"))

lbl.Controls.Add(img)
li.Controls.Add(lbl)
radioButtonList.Controls.Add(li)

Next


Everything seems to be working, but please let me know if you see a better way of doing this.
Andy Miller
#18 Posted : Friday, September 7, 2007 3:07:20 AM(UTC)
Andy Miller

Rank: Member

Joined: 11/5/2003(UTC)
Posts: 2,136

Was thanked: 1 time(s) in 1 post(s)
Cliff,


.NET 3.5 does break Anthem 1.5. If you are building your own Anthem.dll, there is a fix here,



http://anthem-dot-net.cvs.sourceforge.net/anthem-dot-net/anthem/Anthem/Manager.cs?view=log



It turns out that IE has a problem handling images inside of labels. No surprise. The behavior in the article does work, or you can just add the onclick handler to each &lt;img&gt; in the list. Either way, the handler bubbles the event up to the parent (&lt;label&gt; in this case).



I did not really like all the &lt;div&gt;'s in Everett's version of the choice list, so I made a different version of View.ascx(attached). It uses an Anthem.RadioButtonList (just like the normal Radio Button List that comes with BVC5), but instead of DataBind-ing the choices, I create the Text HTML to display the image (and add the onclick handler).



To get rid of all the &lt;table&gt; formatting that RadioButtonList normally outputs, I set RepeatLayout="Flow". To get rid of the &lt;br /&gt; elements that the Flow layout uses to create columns, I set RepeatColumns="0". Now all the choices just flow one after the other.



To center the image under the radio button, I use the following 2 styles:


Code:

[color=#a31515>
span.rbitem</FONT>displayblockfloatlefttext-aligncenter[color=#a31515>
img.rbimgdisplayblock<FONT]}[/color]
File Attachment(s):
View.ascx (2kb) downloaded 198 time(s).

You cannot view/download attachments. Try to login or register.
Andy Miller
Structured Solutions

Shipper 3 - High Velocity Shipment Processing
Cliff
#19 Posted : Friday, September 7, 2007 3:53:14 PM(UTC)
Cliff

Rank: Member

Joined: 5/24/2004(UTC)
Posts: 4,147

Thanks, Andy. Yeah, 3.5 must have been it.

I like your setup better, since it does away with most of those extra spans. I haven't been able to get the behavior to work, and not sure what to do with the onclick handler, though. But I think I've found a way around it in IE, using background images for my swatches. Now I just have to tackle Safari 2's lack of label support.

Appreciate the help!
Andy Miller
#20 Posted : Friday, September 7, 2007 4:07:33 PM(UTC)
Andy Miller

Rank: Member

Joined: 11/5/2003(UTC)
Posts: 2,136

Was thanked: 1 time(s) in 1 post(s)
Background images are probably better ("less is more"). If you are still curious, my View.ascx.vb adds an onclick handler to each foreground image so it looks like this when rendered:

Code:

&lt;label for="zzz"&gt;&lt;img onlick="return bubbleClick(this)" alt="xxx" src="yyy"/&gt;&lt;/label&gt;

Then I added this javascript to the Product.ascx in my ProductTemplate folder,



Code:

function getParentElementByTagName(oElement, tagName)
{
var returnValue = null;
while((oElement = oElement.parentNode) &amp;&amp; oElement != document)
{
if(oElement.tagName &amp;&amp; oElement.tagName.toUpperCase() == tagName.toUpperCase())
{
returnValue = oElement;
break;
}
}
return returnValue;
}

function bubbleClick(el)
{
oParent = getParentElementByTagName(el, 'LABEL');
if(oParent) {
oParent.click();
return false;
}
return true;
}


bubbleClick will find the parent &lt;label&gt; of the image and invoke its click event, then return false to stop the &lt;img&gt;'s click event (so that the event does not bubble up twice in browsers that work).
Andy Miller
Structured Solutions

Shipper 3 - High Velocity Shipment Processing
2 Pages12>
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

©2024 Develisys. All rights reserved.
  • Toll-free  888-665-8637
  • International  +1 717-220-0012