The wire tag redirects the submit of the form to the event routine of the controller. A submit will also toggle the visibility of the “message” element on the page. Note that the action is “postback”, this is obligatory.

The event routine will be called as:

event({submit,Tag,FormId,TargetId},Context).

Where Tag will be the postback set by the wire tag (in the example the atom some_tag) and FormId and TargetId are both the HTML id of the submitted form. The posted input fields can be fetched using z_context:get_q/2, z_context:get_q_all/1 or z_context:get_q_validated/2.

The types can be extended by modules using the #action_event_type
notification. The type must be a tuple, an example is the
{mqtttopic=...} type provided by mod_mqtt

type=”submit”

propagate

Specify this when you don’t want the event to be canceled after
handling the wire. Useful for event types like focus, click etc.
.. versionadded:: 0.6.1

propagate

target

Possible target for the action. The meaning of this argument depends on
the action, defaults to id.

action

Action wired to the element. This parameter can be repeated to wire
more than one action at a time. The value is a single or a list of
action records.

action={toggle
target=”message”}

postback

Postback that will be sent to the event handler of the controller or
the delegate. Either a string, which will be send as an atom, or a
tagged property list. The example will be in Erlang {myevent,[{foo,1},{bar,2}]}.

postback=”ajaxevent”
postback={myevent foo=1 bar=2}

delegate

Name of the Erlang module that will receive the postback. Defaults to
the controller that handled the page request.