Up to [Local Repository] / interchange / code / Widget
Request diff between arbitrary revisions
Keyword substitution: kv
Default branch: MAIN
* Prevent cross-site scripting problem. Found and fixed by Josh Lavin of Perusion.
* Prevent cross-site scripting problem. Found and fixed by Josh Lavin of Perusion.
Fix incorrect license in headers GPL v2 -> GPL v2 "or later". Update copyrights.
Fix incorrect license in headers GPL v2 -> GPL v2 "or later". Update copyrights.
* Add state-size and state-extra parameters to allow some extra control
of the state text box in the country-select widget* This box is
generated in the country-select portion, so must be passed there.
[display
name=state
type=state_select
value="[value state]"
comment="See country_select widget for other related parameters"
]
[display name=country type=country_select
state-size="3"
state-extra="maxlength=3"
value="[value country]"]
* Add header and license information
* Update some Description members. * Add the radio_nbsp Widget variant.
* The variable names in country_select were not necessarily unique. Though
testing worked with two country variables (country and b_country) this
would not necessarily be the case with all browsers/javascript implentations.
Rename all variables to make the code pretty much unique. It could be conflict
with non_standard variable names, so it may take more thought. This should
be at least better.
* Add a callback_prescript and callback_postscript hook for widgets to
use. This allows sending code to an area before the form (prescript)
or after the form (postscript). To begin with, only country_select
uses this.
* Add calls to callback_prescript and callback_postscript to
country_select (if routine is present). This puts the script
code in a better place and removes the necessity for state_select
being before country_select.
* Callbacks could be used like:
[display
name=country
type=country_select
callback_prescript=`sub {
my $val = shift;
$Scratch->{meta_header} .= "\n$val";
return;
}
`
callback_postscript=`sub {
my $val = shift;
$Scratch->{some_footer} .= "\n$val";
return;
}
`
]
* Add descriptions to widgets
* Prevent error on possibly-empty existing state value.
* Fix missing form variable in some situations where we need to go to the forms array.
* Add sort order (with metadata support) for state data.
* Add country_select widget with the following features:
- Uses DOM1.x compliant Javascript.
- Dynamically reads countries from the country table and groups
them by region (or just alphabetically).
- When the country is changed on the widget, it adjust the state
widget automatically to one of three types:
* Entries for that country in state table -- SELECT with
states pre-populated plus blank to force selection.
* No entries in country table, and "no_state" field in
country table set -- puts "no state required" in a
text box and sets a hidden variable to ''.
* No entries in country table, but "no_state" field is
not set. Puts text box at default Vend::Form size.
- WARNING: state_select widget must come before country_select
if it is to reliably work!
- Handles multiple state, b_state, s_state, h_state, etc. on
same form automatically without having to adjust variable names
and element names in metadata.
- Includes metadata entries to set the following options:
* only_with_shipping -- only show countries that have
characters in the "shipmodes" field
* no_region -- Don't sort by world region, just
do alphabetical
* country_sort -- sort fields for country table, usually
the default works (default changes based on no_region).
* country_table -- if you use a table besides "country".
* state_table -- if you use a table besides "state".
* state_var -- allows you to set name of variable
if not a typical interchange one (meaning country -> state,
b_country -> b_state, etc.)
* state_class, state_style -- set CSS for state message text
* form_name -- in case it has trouble figureing out which
form in document. Usually selects first with "country"
variable.
* state_element -- set CSS ID for state widget container,
you normally don't touch this.
* Example would be:
[display name=state type=state_select]
[display name=country type=country_select value=US]
This will output two select boxes (with standard demo) for US countries.
If you change the second select to "Luxembourg" which should have no_state
set, the first select widget will disappear and errmsg("no state required")
will appear.
If you then change the country select to Canada, a select box with
Canadian provinces will appear.