type_="submit"

Using type_="submit" creates a button that either triggers an update of invalidated widgets or executes a <do> clause.

Syntax

<dynamic>
    <widget class_="button" type_="submit" 
     submit_="[WIDGETS_TO_UPDATE]|[DO_ONSUBMIT_IDS]" 
     text_="[DISPLAY_TEXT]"/>
</dynamic>

Attributes for type_="submit"

submit_
Accepts a comma-separated list of either widget names or identifiers to trigger <do> clauses that use an onsubmit_ attribute.

Widgets whose names are referenced by the submit_ attribute will receive an update message when the submit button is pressed. Typically, the widgets specified in submit_ utilize the holdfor_ attribute common to all widgets or have their update_ attribute set to manual. See Example: Manually update widgets using a submit button below.

The submit_ attribute can also specify an identifier that triggers a particular <do> clause when the button is clicked. If the identifier appears in the onsubmit_ attribute in a <do> clause, that <do> clause is executed. See Example: Using onsubmit_ with multiple values in <do>.

Example for type_="submit"

<dynamic conditionalthing="1">
  <do onsubmit_="conditionalwidget">
    <set conditionalthing="{int(@conditionalthing)+1}"/>
  </do>
  <layout>
    <widget class_="button" type_="submit" submit_="conditionalwidget"/>
    <widget name="conditionalwidget" class_="text" text_="{@conditionalthing}" 
     holdfor_="@conditionalthing"/>
  </layout>
</dynamic>

Example: Manually update widgets using a submit button

The following example illustrates how a submit button can be used to update an invalidated widget. When a selection in made in the dropdown widget, the value of the selection variable changes, which invalidates both the sales_grid and store_grid widgets, since both widgets reference that variable in their holdfor_ attributes. Because both grid widgets have update_="manual", they will remain invalidated until they receive an update message. When the user clicks the button whose submit_ attribute is set to sales_grid, a message is sent to the sales_grid widget to update based on the new value of the selection variable. When the user clicks the button whose submit_ attribute is set to store_grid, a message is sent to the store_grid widget to update based on the new value of the selection variable.

<dynamic selection="1">
  <widget class_="dropdown" base_="pub.demo.retail.item" 
   inputwidth_="250" value_="@selection">
    <tabu breaks="store">
      <break col="store" sort="up"/>
      <tcol source="store" fun="cnt"/>
    </tabu>
    <colord cols="store"/>
  </widget>
  <layout arrange_="v">
    <widget class_="button" type_="submit" 
     submit_="sales_grid" text_="Update Sales"/>
    <widget class_="button" type_="submit" 
     submit_="store_grid" text_="Update Stores"/>
  </layout>
  <layout arrange_="v">
    <widget name="sales_grid" class_="grid" 
     base_="pub.demo.retail.item" 
     invmsg_="Press Update Sales" 
     holdfor_="@selection" update_="manual">
      <sel value="store={@selection}"/>
    </widget>
    <widget name="store_grid" class_="grid" 
     base_="pub.demo.retail.store" 
     invmsg_="Press Update Stores" 
     holdfor_="@selection" update_="manual">
      <sel value="store_id={@selection}"/>
    </widget>
  </layout>
</dynamic>