[ic] Putting javascript in a select with item-options

Mike Heins interchange-users@icdevgroup.org
Thu Apr 24 10:10:01 2003


Quoting Chris Wenham (cwenham@synesmedia.com):
> 
>  I need to have an onUpdate javascript function placed in the <select> tag 
> generated by [item-options], perhaps like this:
> 
>  [item-options td=1 label=1 bold=1 price=1 js=| onUpdate="jsfunction()"; |]
> 
>  However, the value of the js parameter is omitted by the time it gets to 
> Vend::Options::tag_options(). 
> 
>  I'm using Matrix options in the CVS development branch. Each option is a 
> separate SKU. What I want is to update the product picture whenever a 
> different variant is chosen from the select widget. I've already added 
> "image" fields to the Options database.
> 

I think you are running afoul of the quoting capability of that subtag
(remember, [PREFIX-thing] is not a real ITL tag) which doesn't include
|.

Try js='onUpdate=jsfunction();'. Or I believe you can format it as a Perl hash:

[item-options
	{
		td => 1,
		label => 1,
		bold => 1,
		price => 1,
		js => q| onUpdate="jsfunction()"|,
	}]

-- 
Mike Heins
Perusion -- Expert Interchange Consulting    http://www.perusion.com/
phone +1.513.523.7621      <mike@perusion.com>

The U.S. Senate -- white male millionaires working for YOU!  -- Dave Barry