github.com/vugu/vugu@v0.3.6-0.20240430171613-3f6f402e014b/vgform/input.go (about)

     1  package vgform
     2  
     3  import "github.com/vugu/vugu"
     4  
     5  // Input corresponds to an input HTML element.
     6  // What you provide for the `type` attribute can trigger behavioral differences appropriate
     7  // for specific input types.
     8  //
     9  // type="checkbox"
    10  // type="radio"
    11  // (list them out)
    12  type Input struct {
    13  	Value   StringValuer // get/set the currently selected value
    14  	AttrMap vugu.AttrMap
    15  }
    16  
    17  func (c *Input) handleChange(event vugu.DOMEvent) {
    18  
    19  	newVal := event.PropString("target", "value")
    20  	// c.curVal = newVal // why not
    21  	c.Value.SetStringValue(newVal)
    22  
    23  }