Set element defaults from URL

  • Views Views: 10,075
  • Last updated Last updated:

Navigation

         Form Article Plugin Tutorial
      Autofill form plugin
      Clone form plugin
      Comment form plugin
      Email form plugin
      EXIF form plugin
      FTP form plugin
      J2store form plugin
      Kunena form plugin
      Limit form plugin
      Logs form plugin
      Mailchimp form plugin
      Paginate form plugin
      Paypal form plugin
      PHP form plugin
      Pingdotfm form plugin
      Receipt form plugin
      Redirect form plugin
      REST form plugin
      Slack form plugin (+)
      SMS form plugin
      Twitter form plugin
      Upsert form plugin
      VBforum form plugin
      Create a Search Form
      Accordion Form Groups
  • 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