[ic] Javascript Updating of Configured Price with Simple Options.

Mark Johnson interchange-users@interchange.redhat.com
Mon Nov 12 11:00:01 2001


Fred Pope wrote:
> 
> Thanks for the input. I have actually tried that too. Looking at the code in
> the Interpolate.pm, I think that you can use both
> js="onupdate=somejavafunction()" or extra="onupdate=somejavafunction()" but
> neither of them seem to be adding any variables into the <select> tags
> generated from the IC [item-options] tag on the flypage, and I am not sure
> why. There must be something that I am missing.
> 
> If you look at Interpolate.pm, there is first the section that builds the
> accessory select box, and then there is the section that uses that if the
> simple options (or matrix / modular for that matter) to generate the various
> select boxes. Mike made the changes to this code yesterday to include the js
> and extra into all of the relevant sections. There is something else.
> 

This appears to be a problem with quoting parameters in [prefix-*] tags.
If you try to do any coding in the JS string itself, you inevitably have
to use quotes (and spaces). The way I was able to get JS through was to
define all the code I needed in a function with no args (or at least no
string args), NO spaces, and just call the function:

js=onChange=myfunc()

Then, myfunc will run.

Obviously, this has extreme limitations, so I've spoken with Jon Jensen
about bringing the quoting of [prefix-*] tags on par with the normal
quoting mechanisms (|,',",`). He is looking into it. However, you can
always pass the object with 'this', and with enough effort you should be
able to accomplish whatever you need in the function. This works since
this is not quoted.

-- 
Mark Johnson
Senior Systems Architect - Professional Services
Red Hat, Inc.
E-Business Solutions
markj@redhat.com
703-456-2912