add record is not working

Status
Not open for further replies.

thiliopoulos

New Member
I have just installed fabrik 1.0.3. I am working with PHP 5.1.4 and MySQL 5.0.22 on a Windows Pro XP environment. I am taking the tutorial "Designing a 'Job Applications' program" step by step but when i built the first table "job types" exactly as described and trying to add a record the info i submit does not enter in the database. Database is built exactly as it should be (tablename: jos_fabrik_formdata_1| fields: fabrik_internal_id, int(11), primary key, auto_increment | time_date, CURRENT TIMESTAMP | jobtypetitle, varchar(255), latin1_swedish_ci). When i run an SQL query with phpMyAdmin the data enter succesfully.

Why i can not insert records from the backend?

I also tried to built the table manually from phpMyAdmin and then add it within fabrik manually. But the same problem occured.
 
athanasios iliopoulos said:
I have just installed fabrik 1.0.3. I am working with PHP 5.1.4 and MySQL 5.0.22 on a Windows Pro XP environment. I am taking the tutorial "Designing a 'Job Applications' program" step by step but when i built the first table "job types" exactly as described and trying to add a record the info i submit does not enter in the database. Database is built exactly as it should be (tablename: jos_fabrik_formdata_1| fields: fabrik_internal_id, int(11), primary key, auto_increment | time_date, CURRENT TIMESTAMP | jobtypetitle, varchar(255), latin1_swedish_ci). When i run an SQL query with phpMyAdmin the data enter succesfully.

Why i can not insert records from the backend?

I also tried to built the table manually from phpMyAdmin and then add it within fabrik manually. But the same problem occured.
Of course in Fabrik->Tables->jobtype (table) the right table (jos_fabrik_formdata_1) and primary key (fabrik_internal_id) are selected. Everything seems configured properly as described and as it is logical to be. Please any answers?
 
Ok i installed SVN tortoise and i downloaded the latest code for fabrik.
I have installed now version 1.0.4 and Joomla 1.0.12. When i try to update my database form an existing form i receive the following error:

Fatal error: Call to a member function databaseTableExists() on a non-object in C:\AppServ\www\Joomla\administrator\components\com_fabrik\admin.fabrik.php on line 522

My installation of fabrik was brand new...I had previously deleted all custom created databases from fabrik using phpMyAdmin. When i installed the SVN files i just copied the two directories administrator/components/com_fabrik/*.* and components/com_fabrik/*.* to the corresponding Joomla site directories. Is there any problem because i just copied the files?

I hope i will get an answer or instructions, because untill now - even if potentially fabrik seems to be a really good tool - i only face bugs and problems...and the overall quality of the product (fabrik) seems a bit unstable.

thanks alot...
 
When you say:

I had previously deleted all custom created databases from fabrik using phpMyAdmin

Do you mean you zapped all of your Fabrik tables, or just the ones it created for your forms prior to upgrading?

What I suspect has happened is that you deleted the form specific table(s), but didn't actually remove the references to them in the main Fabrik tables (like jos_fabrik_tables).

Try firing up phpMyAdmin again, and browse the jos_fabrik_tables table. If it still has references to your old, deleted table(s), remove those entries. This *may* enable Fabrik to recreate your table from your forms.

If not, you may just want to uninstall Fabrik entirely, and start again with the 1.04 ZIP, and re-upload the latest SVN code on top of a completely fresh install. It wouldn't be impossible to mend your install with phpMyAdmin, but it would take longer to talk you through doing that than it would for you to just scrape it clean and start again.

-- hugh
 
Ok thanks for the reply,

but, i uninstalled fabrik entirely, all the fabrik databases where deleted from phpMyAdmin (including the forms databases). Then i installed fabrik 1.0.4 from the beggining and replaced the code with the latest SVN version. The installation was completed succesfully but still the same problem occurs as i describe below:

I created a test group, then a testfield element (text field) and a corresponding form. When i try to update database i receive the following error:

Fatal error: Call to a member function databaseTableExists() on a non-object in C:\AppServ\www\Joomla\administrator\components\com_fabrik\admin.fabrik.php on line 522

When i navigate to phpMyAdmin i can see that the table has created. Its name is jos_fabrik_formdata_1 and it has three fields (fabrik_internal_id, testfield1, time_date) as it should be. Also there is the corresponding record in the jos_fabrik_tables table for this table.
 
I'll try to replicate this problem on my test machine. I did have some issues creating tables a few SVN revisions ago (not exactly the problem you are describing, more kinda "general wierdness") but I thought those had been cleared up around rev 172.

I'll get back to you soon.

-- hugh
 
OK, I think i see what's going on.

Try this:

Go back to the Forms admin view, and "Create database view" (far right, by "Update Database"). Or it might say "Create table view", I forget.

Once you have created the new "Table" view, try "Update Database" again. It should work this time, and instead of "Create database view" it should now say "View Database" on the far right.

Meanwhile I'll test a fix for this bug ...

-- hugh
 
Thanks for taking the time to deal with my problem. I have made several experimentations in order to find a solution or a logical explenation for what is going on so, i will give you the information hoping that it will assist you to find what is going on.

1) I installed the sample data: Contact Us Data table, form and elements. I try to add a record and the same problem occurs. The insertion is not taking place. If i enter the data from phpMyAdmin, fabrik component is able to read and delete it.

I have firebug installed on my Mozilla browser and when i select add record -> and i am at Contact Us form (where i enter the info to submit) there are two errors on page:

a) fbField is not defined
(no name)()index2.php (line 512)
returns()mootools.js (line 21)
create(undefined)mootools.js (line 21)
fireEvent(function())mootools.js (line 48)
fireEvent("domready", undefined, undefined)mootools.js (line 48)
domReady()mootools.js (line 56)
returns()mootools.js (line 21)
create(DOMContentLoaded )mootools.js (line 21)
[Break on this error] <tr>

and

b) ofabrik is not defined
(no name)(load )index2.php (line 502)
[Break on this error] ofabrik.addElement(el);

i do not know if this is relevant to failing submitting the data!!

2) I made another test in order to see if i can access an existing mySQL table from fabrik. I created a custom table in SQL (named custom_table) with 3 fields: id (primary key, int(11), autoincrement) - field1 (varchar(255)) - field2 (varchar(255)).

Then form fabrik->Tables->New: i created in fabrik a new table with title custom_table, then form data tab i selected the site database, the Database Table to link to: custom_table, and primary key: id (the primary key of the original table) Auto Incrementing Key. I saved the table and fabrik created the corresponding group, form and elements.

Everything seems to be as it should be but when i try to add a record and click save the information i submit is not recorded in the database. There is no error message but the insertion is not taking place. I can delete or read records for the table from the backend but i can not insert.
 
Ok i followed your instructions using the latest SVN code... I created a new group (test), a new element (testfield - text field) and a new form (test). I saved the form. In the admin->fabrik->forms i did not select neither update database, nor create table view! I navigated to admin->fabrik->tables and the table was created!!!! I think this was not supposed to happen :) Then i went back to admin->fabrik->forms and i selected update database and then i had the error:

Fatal error: Call to a member function databaseTableExists() on a non-object in C:\AppServ\www\Joomla\administrator\components\com_fabrik\admin.fabrik.php on line 522

previously i have checked jos_fabrik_tables table (and all other fabrik tables) and it was empty but the table that was created for the new form was jos_fabrik_formdata_2!! Should not it be jos_fabrik_formdata1???

I closed the mozilla window and i opened a new joomla admin window. I navigated to admin->fabrik->forms, i selected update databse and everything seems ok. No error messages. Then view database-> add record but again the info i submit is not iserting into the table!
 
ok... i am a little fed up with trying to locate the problem, or at least find a standard algorithm of the way it is happening. The overall behavior of the fabrik component seem to be very unstable.

I have installed and uninstalled fabrik more than 15 times... Now every time i create a form the table is automatically created, without selecting update database or create database view.

If afterwards i select update database i receive the error:

Fatal error: Call to a member function databaseTableExists() on a non-object in C:\AppServ\www\Joomla\administrator\components\com_fabrik\admin.fabrik.php on line 522

which i suppose is caused becuase the table has already created internally when i SAVED the form for the first time

Then is i select create table view, the form for the new table is prompted. This is the supposed table for the corresponding table at mySQL because when i select the primary key (id->fabrik_internal_id) the autoincrement box is automatically selected, thus meaning the fabrik recognized the original (mySQL) table. Instead at the initially (and by sytsemfault) created table the primary key is not recognized correctly.

If i delete the first table and the corresponding elements, i continue by using the second one that seems to be all right. But when i am going to insert a record nothing happens. Then i go to elements, i located the element for fabrik_internal_id i select it and i saw that the maximum length is set to zero (max length=0), i alter the value to blank (the default value), i save the element and the i go to table->addrecord, i enter my data and OOPSSS it enters to the database! But the id is NULL, like the autoincrement is not functioning well!! I try then to add another record and nothing happens!!! this is normal because as i saw in phpMyAdmin the id for the first record in the table is blank!!!

I have installed Joomla 1.0.12 and everything else i use is functioning properly so i think my system is stable. When i uninstall fabrik, i just uninstall fabrik component from back end and then check for any databse tables in phpMyAdmin that have left from previous installations of fabrik and drop them... Does the procedure includes more steps?

I do not know...but it seems very weird to me, because i used fabrik 1.0.3 and 1.0.4 at another computer and seem to work stable...

Thnx

th
 
Yes, Fabrik will auto-create the table when you create a new form, if you have selected the 'Record in Database' option. Which is how I would expect it to behave. It can't store the form results in the database if there is no table to store stuff in.

I went through the folowing steps, and things work OK.

1) Created "Test Group".
2) Created a couple of test elements.
3) Created a "Test Form", assigning "Test Group" to it, and selecting the "Record to Database" option.
4) Went to the "Table" list, and clicked on "Create Table View" for the newly created table.
5) Added both the form and table views to my main menu.
6) Opened the form, filled out my test fields, saved.
7) Opened the table view, the newly created record is right there.

Please try running thru those steps EXACTLY as described, and see if it works.

Now, there *is* a bug which I *think* will cause the problems you are seeing, if you do an "Update Database" AFTER the form is auto-created, but BEFORE you create the Table View, i.e. if you do an Update Database between steps 3) and 4) above, then Fabrik will get its panties in a wad.

I think I've fixed that, and will be posting a bug report when I've tested the fix. The problem is in these lines in updatefabrikDatabase():

Code:
	if ( !$oTable->databaseTableExists( ) ) {
		$oTable->createFormTable( $oForm );
	} else {
		$oTable->ammendTable( $oForm );
	}

The problem is, $oTable will only exist at that point if the "Table View" has been created. So if you try and dot he "update" before "create view", Fabrik may well try and create a second new database, instead of updating the one it auto-created when you saved the form.

So ... give those instructions above a go, and see if that works.

-- hugh
 
Ok i have taken the steps you are suggesting in your instructions..but,

in STEP 4) when i go to the "Table" list, there is no such a choice like "Create Table View" for the newly created table, the only choice that is visible for the newly created table is: "View Database". When i go to the forms list, there are two options, a) update database and b) create table view; but the table has already created so there is no meaning to select "create table" view because a second table view will be created ...

Is this logical?

So i found it more sensible to select the newly created table (test) ...and select the primary key (id) and set to autoincrementing key, because by default there was no primary key selected for the table. I saved the table and then i tried to insert some info into the table but i received the following error:

Fatal error: Cannot access empty property in C:\AppServ\www\applications\Joomla\components\com_fabrik\fabrik_table.class.php on line 2844

then, i checked the element fabrik_internal_id and found that it was created by the system with:
Maximum Length=0. I changed the value for this property to
Maximum Length=blank (default value)
and then try to add a record into the table but the same error occured.

The next thing i tried is i went to form list, and i selected "Create Table View" for the test form. then the i created the table with the proper properties and named it testb. So now i had two table views for the same mySQL table jos_fabrik_formdata1. Then i selected "update database" from the form list, and then from table list i tried to insert some records for testb table. When i try to save the info into the table no error messages are displayed but the record is not entering.

I hope the description was detailed enough.

The thing that troubles me is that when i create the form (test) as you instructed me, i saved it and then there was already a table named (test), on the tables list, without selecting create table view from form list. I think that in fabrik 1.0.3 this is not happening... You have to manually built the table by selecting create database view from the form list. I think this causes the problem.

Alternatively, when i saved the form and the database was built automatically then in the tables list there is no choise like create table view...only view database...I guess that at step 4 instead the tables list you ment form lists -> create table view. But as i told you before the table was already created when i SAVED the form! So when i select "create table view" a secong table is created, that messes up fabrik.

I used SVN code rev.175 which i downloaded yesterday...

Hope i was clear enough

Regards!
 
I tried to follow the same steps on fabrik 1.0.3 and i followed the instructions you gave me before.

There is a major difference on how the things work between the two releases. In fabrik 1.0.3 i done the following

1) Created a test group, a testfield1 text field element (just this), and a test form (i added test group to that form).
2) I selected the "Record to Database" option and clicked SAVE.
3) I checked at the tables list and no database was created! in fabrik 1.0.4 there was a database created (named as the form, test) just after i selected to SAVE the form.
4) In form list, i selected create table view, and i created my table that corresponds to the test form.
5) I added both form+table to main menu.
6) I selected from the main menu the form link and tried to add some data. the error i receive is:

Field \'fabrik_internal_id\' doesn\'t have a default value SQL=INSERT INTO jos_fabrik_formdata_1 (`testfield1`) VALUES (\'rrrrret543t5\')

i checked the table jos_fabrik_formdata_1 and what the hell... The field testfield1 that i had created was int(11) autoncrement and the time_date field was varchar(255)...

When i created the elements for the group, i only created the text field, i supposed that the other two will be created internally by fabrik...But fabrik created them wrong@@@@

I do not know what is going on...i am going back to version 1.0.4... But i am loosing my faith to the product ??? Please help!!
 
thiliop said:
Ok i have taken the steps you are suggesting in your instructions..but,

in STEP 4) when i go to the "Table" list, there is no such a choice like "Create Table View" for the newly created table, the only choice that is visible for the newly created table is: "View Database". When i go to the forms list, there are two options, a) update database and b) create table view; but the table has already created so there is no meaning to select "create table" view because a second table view will be created ...

Is this logical?

My apologies, in Step 4) I meant the Form page, not the Table page. But the important thing was to "Create Table View", before doing anything else with the table or the form.

Whether it is logical or not is not entirely clear, but a "Table View" is not the same thing as a "Table". It needs to be created separately.

So i found it more sensible
[...]

Ah, but I what I need is for you to follow the instructions, so I can confirm this behavior and hence fix it. So could you try it again, this time "Create Table View" in step 4) on the Form page.

Hopefully, if you do that, things will then work, and I'll have the confirmation I need. I'm pretty sure I know whats going on and how to fix it, but I'd like someone else to run through the same steps and confirm the results I get. In the same way I ran through your steps to confirm the bug itself.

NOTE - the behavior of form / table creation between 1.03 and 1.04 has changed.

-- hugh
 
Ok Hugh and thanks for replying,

i have downloaded SVN 177 release and worked with this piece fo code... I made an entirely new installation and here are the steps i followed:

1) Created a Test Group named "test" .
2) Created a test elements of type text field named "testfield1" (width=50, maximum length=255, format=text).
3) Created a Test Form named "test", assigning "test" Group to it, and selected the "Record to Database" option.
4) In Fabrik-> Forms i selected "Create table view" for the newly created form.
5) Then i transfered to the "Add a Table" form where i enter the settings for the table view. As a label i picked "testtable", in data tab there was selected by default "Database Connection to use:site database", "Database Table to link to:jos_fabrik_formdata_1", i clicked the "Apply" button and then automatically the data tab updated with "Primary Key:id", "Auto Incrementing Key:yes". I saved the table and transfered to the fabrik-> tables list, where i can see my table "testtable" as also another table named "test".
6) Added both the form and table views (testtable) to my main menu.
7) Went to the frontend, clicked the link for the form, insert some data to the field and then clicked save. the following error occured:

Out of range value adjusted for column \'fabrik_internal_id\' at row 1 SQL=INSERT INTO jos_fabrik_formdata_1 ( `fabrik_internal_id`,`testfield1`,`time_date` ) VALUES ( \'\',\'trhjtyj\',\'2007-09-03\' )

These are the exact steps i am taking!!! So, do i need to alter the code? As i told you when i create the form and click SAVE... at this moment as it is ibvious the table view with the name of the form is creating!! So when after you click Create table view another table pointing to the same mySQL table, the same form and group is created...

I can check this because after if i go to the fabrik -> elements, i can see 6 elements, 3 for each table view. The 3 first has been properly created (names,labels,group etc) and correspond to table view "test". the other 3 correspond to table view "testtable" and are created corrupted, no name, no type, no group...all blank.

I followed the exact steps...
 
I'll try and duplicate your findings in a while.

It's Labor Day Monday, and I have to go mow my yard. I do it once a year, whether it needs it or not. :)

-- hugh
 
Well, that's the front yard done, anyway.

BTW, I'm aware of how frustrating this is for you, and I just wanted to thank you for sticking with me. There is definitely something not right in the automatic table creation, and I experienced exactly the symptoms you are seeing a few weeks ago. I just haven't been able to replicate the problems in a 'reproduceable' way yet, which makes it hard to debug.

I'm about to run thru the steps you described.

-- hugh
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top