[ic] Run javascript with country_select.widget
Jon Jensen
jon at endpoint.com
Mon Sep 14 19:10:59 UTC 2009
On Mon, 14 Sep 2009, Josh Lavin wrote:
> I made a change to the country_select widget, so you can run Javascript,
> like the check_tax routine:
>
> Adds state_js option, so Javascript can be passed to the onChange event.
> Rewrites "this.form" with "$v_formv" so it will work when passed. Useful
> for calling check_tax like so: state_js="check_tax(this.form)".
>
> http://github.com/jlavin/interchange/commit/76eda3c78f384bf36108e0a39fa1729ddc3d53b6
That sounds useful.
Substituting JavaScript code will always be inexact, but I wonder if we
could somewhat improve this:
$state_js =~ s|this\.form|$v_formv|g;
by changing it to this:
$state_js =~ s|\bthis\.form\b|$v_formv|g;
Could we also have the ; here after this.value be appended in $state_js
instead of always?
- var str = '<select name="$svar_in" onChange="$v_formv.$svar.value = this.value">';
+ var str = '<select name="$svar_in" onChange="$v_formv.$svar.value = this.value;$state_js">';
Thanks,
Jon
--
Jon Jensen
End Point Corporation
http://www.endpoint.com/
More information about the interchange-users
mailing list