Skip to content

11 v_form_auto

Generates a form from the parameters of an SRS and runs the SRS on submit.

  • loads the SRS definition with a GET request and shows one field per param
  • on submit, sends the field values as a POST to /api/{srsurl}/run.json (with ?pscope={scope} when scope is set)
  • the first row of the first command prefills empty fields with matching names

Props

Required

  • srsurl - SRS path, for example srs/946
    • when missing, the component reads srsurl from the query string, or builds it from the /form-srs/:name/:renderer? route (srs/{name}/{renderer}, default renderer auto)

Optional

  • scope - command name; shows only parameters without scope or scoped to this command, and runs only this command
  • confirm - (true/false) asks for confirmation before submit; default is false
  • css - CSS class of the form; default xd-content xd-padding
  • params - object merged with the props; used when the component is opened from an SRS column or option
    • all keys (except clipboard_items) are added to the query string of the GET request, so the SRS can use them as parameters, for example to prefill the form
    • jqclipboard - name of the parameter that receives the selected rows (clipboard_items); after a successful submit the table is reloaded and the dialog is closed
  • clipboard_items - selected rows, passed by v_srs_table

Note

In params, only srsurl and jqclipboard are fully supported. scope limits the executed command but not the visible fields, and confirm is ignored. Pass scope and confirm as props, or use an option with opts="uimenu".

Fields

The field is chosen from the parameter type:

  • number - number input
  • date - date input
  • checkbox - Yes/No dropdown
  • textarea - text area
  • codemirror - code editor
  • any other type - HTML input of that type, default text

Parameter attributes used by the form:

  • label - field label
  • title - hint below the field
  • opts="req" - required field
  • css="xd-disabled" - disabled field
  • lg="false" - hidden field

UI Examples

UI

Examples

Basic html

HTML
<v_form_auto label="Form" srsurl="srs/713"></v_form_auto>

Html with modal

HTML
1
2
3
<v_modal label="test" @close="">
  <v_form_auto label="Form" srsurl="srs/713"></v_form_auto>
</v_modal>

SRS Option

XML
1
2
3
<itm model="option" type="v_form_auto" label="Test auto form">
  <![CDATA[ { "srsurl":"srs/715" } ]]> <!--Props-->
</itm>

SRS Column

The column value opens the form in a modal. {columnName} placeholders are replaced with the row values. See Custom component column.

XML
1
2
3
<itm model="column" name="locationCode" type="v_form_auto" label="Location code">
  <![CDATA[ { "srsurl":"srs/993/api", "locationID":"{locationID}" } ]]>
</itm>

The same with a link column:

XML
1
2
3
<itm model="column" type="tlink_modal" name="locationCode" label="Location code" ex="false">
  <![CDATA[/get/form_auto?srsurl=srs/993/api&locationID={locationID}]]>
</itm>

Custom run from url

Text Only
/get/form_auto?srsurl=srs/713
/form-srs/713