Javascript locationChanged
James Cobban edited this page Nov 16, 2019
·
14 revisions
Up: Javascript Programming Guide
The function locationChanged
is the change event handler for fields which contain the text representation of a Location. This method is invoked with this
a reference to the <input>
tag, and is passed an instance of a change event
object as a parameter.
The function performs a number of operations on the value
of the <input>
element:
- Spaces are inserted to separate alphabetic and numeric tokens except for a few exceptional situations. For example "125King St" is corrected to "125 King St", but "3rd Ave" is not changed.
- Most words are capitalized. For example "london, middlesex, ontario, canada" is changed to "London, Middlesex, Ontario, Canada".
- A set of common words are treated as abbreviations and replaced. This is used to speed up data entry, for example the stand-alone letter "E" is replaced by "England", and "1/2" is replaced by "½". This is also used for words which are not capitalized or are completely capitalized in location names. For example "Lot" is replaced by "lot", and "Mb" is replaced by "MB".
- To avoid creating unnecessary alternate versions of rural addresses if the concession portion precedes the lot portion they are swapped. For example "con 4 lot 12" is replaced by "lot 12 con 4".
Next: function gotDialogs(xml)