Capture data-locate-key for new GetForm API functions

This commit is contained in:
2023-12-12 04:46:33 -06:00
parent 711979a7d1
commit c970ee4ef8
2 changed files with 4 additions and 0 deletions

3
api.go
View File

@@ -123,11 +123,14 @@ func GetLocations() []Location {
doc.Find("input.property").Each(func(i int, s *goquery.Selection) {
matches := parsePattern.FindStringSubmatch(s.Parent().Text())
key_attr, _ := s.Attr("data-locate-key")
id_attr, _ := s.Attr("value")
id, _ := strconv.ParseUint(id_attr, 10, 32)
cachedLocations = append(cachedLocations, Location{
id: uint(id),
key: key_attr,
name: matches[1],
address: matches[2] + " " + matches[3],
})

View File

@@ -2,6 +2,7 @@ package main
type Location struct {
id uint // Used for registration internally
key string // Used for registration form lookup
name string // Used for autocomplete & location selection
address string // Not used in this application so far
}