Form Limit plugin

esskay

Member
I am trying to setup a form and list with "add limit". I am using Form limit plugin. User is allowed to add only one record to the list unless limit is increased by admin. I have created an element where admins can manually increase the limit. I am running sql query to add the record first time which is INSERT INTO `my_table`(`add_limit`, `created_by`) VALUES ('1', '{$my->id}'). This query adds the record but immediately after clicking "add" user gets the limit reached message. User has to than edit the record. This is confusing.

What I need is as under -

1. Set the default limit to 1 so that the user of a particular group can add record without any warning
2. User cannot add another record unless limit is increased by the admin

In my above setup, if I do not run sql query user cannot add the record at all since the pre filtered table is empty and there is no lookup and max element to watch.

Can someone guide me to the right direction in this situation ?
 
Did you set the "Limit length"?

That parameter has two purposes - either as the single overall limit for everyone, OR to be used as the default limit, when in "lookup list mode", if the user doesn't yet have an entry in the lookup list, and the "Add limit SQL" has to be run.

-- hugh
 
Yes..I had tried with "Limit Length" settings but it does not work. I have tried with the following settings -

First Try -

1. Limit Length - 1
2. Lookup List - My List
3. Type - User
4. Lookup Element - User Element in the My List
5. Max Element - Limit Element which is a field element
6. Add Limit SQL - None

Result - I get Limit Reached Message. No records are added.

Second Try -

From 1-5 same settings as above
6. INSERT INTO `my_list`(`add_limit`, `created_by`) VALUES ('1', '{$my->id}')

Result - I get limit reached message. One record is added - This is I think by SQL Query. When I click again on Add I get limit reached message.

Third Try -

From 1-5 same settings
6. Add Limit SQL - None
7. User Element - User element

Result - I get limit reached message. No records are added.

Fourth Try -

From 1-5 same settings
6. Add Limit SQL - INSERT INTO `my_list`(`add_limit`, `created_by`) VALUES ('1', '{$my->id}')
7. User Element - User Element

Result - I get limit reached message. One recod is added - This is again because of SQL Query

IT MEANS DEFAULT LIMIT OF 1 IS NOT AT ALL WORKING.

Expected Result -

WHEN I SET LIMIT LENGTH TO 1 THE FIRST RECORD SHOULD HAVE BEEN ADDED WITHOUT SQL AND FOR NEW RECORDS LOOKUP SHOULD BE IN LIMIT ELEMENT AS PER PLUGIN SETTINGS. SQL QUERY IN MY SETUP SHOULD NOT BE NEEDED.

Note : In connection tooltip it is written "Override the 'Limit Length' option with a lookup to another Fabrik list". This suggests that anything which is set here will override the default limit set in limit length.

Please Advise...
 
Last edited:
Alright...I think this problem was due to limit element I created in the same list. I have created another list for the limit and the issue seems to be fixed. I am still testing and get back if any problem...
 
I have created another list with limit field element. In the main list I have added this field element as database join to show the value in the main list. What is the best way to enable me to modify the databasejoin element. I get option to add record in plugin settings but I do not want to add...Just to modify and increase the limit....I do not know whether this is the best way to achieve this but I just need to increase the limit from frontend depending upon the situation. Please provide the best solution...
 
There's no easy way to do that from the form for the main list.

The only way I can think of would be with some custom JS on the form, which makes an AJAX call that runs custom user_ajax.php code (see ./components/com_fabrik/user_ajax_example.php).

Typically, people manage the row limits table as a separate list/form. Put an element filter on the user element. When you want to up the limit for a given user, go to the limit list, search for that user, edit their row and change it there.

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

Thank you.

Members online

No members online now.
Back
Top