{fabrik view=form id=1 tablename___elementname=foobar} doesn't work

mazhar996

New Member
Hi there,
This is my first post. First of all my respect for this superb project.

Then i need a little help.
i have installed fabrik plugin and it works fine except following two options:

{fabrik view=form id=1 tablename___elementname=foobar}

doesn't show the records

the description says that it will filter the table to show only records where 'elementname' has a value of 'foobar'

i have tried it to use with a table named test and an element named Land in different variabtions. For example:

{fabrik view=form id=3 tablename___Land=Germany}
{fabrik view=form id=3 test___Land=Germany}


Secondly i have also tried the following:

{fabrik view=element table=3 rowid=1 element=element_Land___checkbox}

the table and forms ids are correct.

please note that i have searched for this on this forum first and i am posting it after not finding the answer to my problem.

it will be great if someone comments.

best regards
 
can you point us at the page?
What element type is the "land" element?

Cheers
Rob
 
And just to clear one thing up ... wherever we talk about tablename___elementname, you need to substitute both 'tablename' and 'elementname' with your form / table specific values. The 'tablename' is the underlying MySQL table name, and elementname is the name you gave your element. Both are case sensitive.

Easiest way to check what your full element names should be is to either view the source of your form page, or use FireFox with FireBug installed and enabled (then "inspect" your elements on the page). We use the tablename___elementname as ID and name for your elements on the page.

-- hugh
 
thank you both for your quick responses:
ok yesterday i was using the tablename as what i defined in the fabrik tables and not the one underlying mysql table.

today i tried it with the mysql table name but with no success

this is what i see in the page source
input class = "fabrikinput inputbox text" type = "text" name = "jos_test___Land" id = "jos_test___Land" value = ""

so apparently jos_test___Land is the element name

and this is what i have in my content page
{fabrik view=form id=10 jos_test___Land=Germany}

this command doen't display the form where Land's value is Germany. i have also tried with
{fabrik view=form id=10 jos_test___Land='Germany'}

then the following command
{fabrik view=element table=11 rowid=1 element=element_Land___checkbox}

doesn't display any page. the body of the page is empty in this case, so i believe this causes some php error or something . i don't know because i am no good with php.

please advise

BR
mazhar
 
Hi Rob,
did you test it after the fix?
I am at revision 1401 , the bug fix is in revision 1397
i replaced all the files with the recent update from svn
in particular i re-checked that fabrik.php in plugins/content and its to newest stand.
but both the issues above listed are still there. and exactly the same issues.
i request you to kindly have a re-look at the fix.
sincere regards
mazhar
 
i did test and it does work for me with this syntax:


{fabrik view=form id=10 jos_test___Land=Germany}
 
Hi rob,
thank you again for the reply, but i believe you really need to have a re-look because it has a new bug now:
with the syntax
{fabrik view=form id=10 jos_test___Land=Germany}

it displays only the string that is after the equal sign, in this case Germany
it displays anything i put after the equal sign as it is. that is this is not checking the values from database, rather simply dispalying whatever after the equal sign comes.

for example if you do {fabrik view=form id=10 jos_test___Land=ABCDEFGHIJKLMNOPQRSTUVWXYZ}

it will display the form with ABCDEFGHIJKLMNOPQRSTUVWXYZ . infact in the table jos_test there is no Land value equal to ABCDEFGHIJKLMNOPQRSTUVWXYZ

finally no other fields of jos_test are displayed.

BR
mazhar
 
Well that's the expected result. You aren't giving it a rowid, so it's opening a new form, and pre-filling that field with the value you gave it.

You can't use this feature as a 'filter' for forms ... form invocations need a specific rowid (i.e. the PK value) if you want to load an existing form. Exception might be if you provide usekey=foo, but I'm not sure if we support that feature yet in the plugin.

-- hugh
 
I should have spotted the disconnect in your first post:

Then i need a little help.
i have installed fabrik plugin and it works fine except following two options:

{fabrik view=form id=1 tablename___elementname=foobar}

doesn't show the records

the description says that it will filter the table to show only records where 'elementname' has a value of 'foobar'
Where you correctly state that "the description says that it will filter the table to show only records where 'elementname' has a value of 'foobar'" ... but you were using view=form, not view=table.

Only tables can be "filtered". If you are invoking a form, you can only give it a single row identifier, as a form (by it's nature) can only do one of two things - create a new row, or edit a single existing row. You load multiple forms.

However ... if you have some other element (other than the primary key element, usually fabrik_internal_id) which has a UNIQUE value, you can cheat by telling Fabrik to use your other element as the index, instead of 'rowid' (the primary key). So on a URL, you can do ...

...&view=form&rowid=X&usekey=some_element

... which tells Fabrik to use 'some_element' to look up the value X in, rather than the default primary key of the table.

However ... I don't think we've enabled the use of 'usekey' via the plugin. If this sounds like it may be useful for you (i.e. if your Land element has unique values, so only one row will match any given value), I can take a look at allowing usekey in the plugin.

-- hugh
 
Dear hugh,
thank you very much for this detailed message.
Actually what i need i have achieved using the following:
{fabrik view=table id=1 jos_rates___Land=Germany}

This displays the filtered results, so i believe you need to change the syntax description for plugin. For example the description says

{fabrik view=form id=1 tablename___elementname=foobar} will filter the table to show only records where 'elementname' has a value of 'foobar'

it should be {fabrik view=table id=1 tablename___elementname=foobar}

so one should use "table id" instead of "form id"

There is a only a small problem with this filter in plugin.

if you write {fabrik view=table id=1 jos_rates___Land=Germany T-Mobile}

It will still display results filtered by only Germany. So it checks only for the first word in the filter.

now it will be so nice if you can explain what you wrote in your last message.

" ...&view=form&rowid=X&usekey=some_element
... which tells Fabrik to use 'some_element' to look up the value X in, rather than the default primary key of the table. "

if this can not be used in plugin, where can it be used? in the components?, how? in there we have already many other very useful filter options.


BR
mazhar
 
Try replacing the space with an HTML encoding (%20) or maybe a + sign. Might now work, but then again it might.

The 'usekey' is processed as a query string arg. So you can add it to URL's manually, or (the most common usage) on a Fabrik form component link. See the User Profile tutorial for an example of setting up a Form menu item with rowid=-1 and usekey.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top