-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhiddenfield.go
46 lines (34 loc) · 916 Bytes
/
hiddenfield.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package xdommask
import "github.com/webability-go/wajaf"
// hiddenfield is a hidden field to pass information between field group and server.
// It should have a default value and is setable by code. Its value will be send to the server in any mode if authorized
type HiddenField struct {
*DataField
DefaultValue string
}
func NewHiddenField(name string) *HiddenField {
hf := &HiddenField{DataField: NewDataField(name)}
hf.Type = HIDDEN
return hf
}
func (f *HiddenField) Compile() wajaf.NodeDef {
h := wajaf.NewHiddenFieldElement(f.ID)
h.SetData(f.DefaultValue)
return h
}
/*
class DomMaskHiddenField extends DomMaskField
{
function __construct($name = '', $iftable = false)
{
parent::__construct($name, $iftable);
$this->type = 'hidden';
}
public function create()
{
$f = new \wajaf\hiddenfieldElement($this->name);
$f->setData($this->default);
return $f;
}
}
*/