Set element defaults from URL

  • Views Views: 10,942
  • Last updated Last updated:
  • By defining a custom link for an Add button (to add a new record), you can alter one or more Elements' default values by altering the URL's querystring.

    So presuming that your form's URL is:
    Code:

    http://site.com/index.php?option=com_fabrik&view=form&formid=1
    and you have an element whose full name is 'mydata___name', to fill that element with the value 'Rob' you can alter the query string to be:
    Code:

    http://site.com/index.php?option=com_fabrik&view=form&formid=1&mydata___name=Rob

    Note: For element's such as checkboxes, dropdowns or radio buttons, the value supplied in the querystring must be the value that is stored in the database and not the attached label. So say we have a checkbox whose full name is 'mydata_ok' and which has a single sub-option value = 1, label 'yes', our URL would be
    Code:

    http://site.com/index.php?option=com_fabrik&view=form&formid=1&mydata___ok=1
Back
Top