Javascript templeChanged - jcobban/Genealogy GitHub Wiki
The function templeChanged
is the change event handler for fields which contain the text representation of a Church of Latter Day Saints Temple
. 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 after commas if required.
- 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.
Once these normalizations have been completed on the input value, the database is searched using /Family/getTempleJSON.php
to find matching instances of class Temple
. If there is only one Temple
which starts with the string value then the full name of the Temple
is supplied. If there is more than one Temple
which starts with the string value then a dialog is displayed to permit selecting one existing Temple
. If there is no matching Temple
the application displays a warning. For example if you enter "Toronto" this matches the pre-defined Temple
"Toronto, ON, CA".