Prefilling forms

garou

New Member
We have a form used to request journal articles.

One or our vendors has an index of journal citations and we would like to craft a link from their system that would automatically drop some of that citation into our request form when they link to it.

So is it possible to prefil Fabrik form fields based on information passed through the linking URL?

Thanks.
 
Found a partial answer

I ended up finding a great suggestion from jfquestiaux (see below). And it works on all of my fields so far, except for when I'm using a drop down box. When I use a dropdown and I check the eval box and put the formula in then save. The formula and the check in the eval box are removed and this field does not pick up any data from the URL next time.

Am I missing something here, or is there a bug in this behaviour?

++++++++++++
For the "prefilled" data, you can use the "default" field of the element : if it is always the same data, just put its value in the "default" field.
If the data has to be computed or retreived from a database, you need to put some PHP code in the "default" field and check the "eval" checkbox.

To retreive the data from the URL, you have to use the same thing.
Suppose you want to retreive "XXX" from this URL to your form (x = id of your form):

http://... index.php?option=com_fabrik&c=form&view=form&fabri k=x&tableid=x&rowid=0&Itemid=16&mydata=XXX&...

you have to put in the "default" field of the element in your form where you wish to collect the data the following code :

Code:
return JRequest::getVar('mydata');
Don't forget to check the "eval" checkbox for this element.
 
Back
Top