Browse Source

Added functionality to change the page title when rendering pseudo pages. Added functionality to get an individual form field value.

Wirecog 6 years ago
parent
commit
517639528f
2 changed files with 14 additions and 0 deletions
  1. 9
    0
      basicform.go
  2. 5
    0
      template.go

+ 9
- 0
basicform.go View File

40
 	c.fields = fields
40
 	c.fields = fields
41
 }
41
 }
42
 
42
 
43
+func (c *BasicForm) GetFieldValue(key string) string {
44
+
45
+	if _, ok := c.fields[key]; ok {
46
+		return c.fields[key]
47
+	} else {
48
+		return ""
49
+	}
50
+}
51
+
43
 func (c *BasicForm) SetErrors(errors map[string]string) {
52
 func (c *BasicForm) SetErrors(errors map[string]string) {
44
 	c.errors = errors
53
 	c.errors = errors
45
 }
54
 }

+ 5
- 0
template.go View File

49
 	ShouldPopulateRenderedContent bool
49
 	ShouldPopulateRenderedContent bool
50
 	RenderedContent               string
50
 	RenderedContent               string
51
 	ShouldSkipFinalRenderStep     bool
51
 	ShouldSkipFinalRenderStep     bool
52
+	PageTitle                     string
52
 }
53
 }
53
 
54
 
54
 func (t *Template) GetTemplateType() int8 {
55
 func (t *Template) GetTemplateType() int8 {
143
 		params.Element.AppendChild(div)
144
 		params.Element.AppendChild(div)
144
 	}
145
 	}
145
 
146
 
147
+	if params.PageTitle != "" && params.ShouldPopulateRenderedContent == false {
148
+		dom.GetWindow().Document().Underlying().Set("title", params.PageTitle)
149
+	}
150
+
146
 }
151
 }
147
 
152
 
148
 func (t *Template) RenderTemplateOnServer(params *RenderParams) {
153
 func (t *Template) RenderTemplateOnServer(params *RenderParams) {