Hi all,
I have This..


My form looks like this

My db table looks like this

Here is my debug at the submit button...

The problem is that it creates a record in the db table with a 0 in the "user_id_link" and NO OTHER INFO, and that ONLY occurs if I use this.

If I say NO to the "Load under model id" then it does not even do that.
I have tried the DB save with either the "Save under model ID" as Yes and No, also I have tried the model Id as just "profile" as well as I have it now and nothing makes it save the record successfully.

I just want it to be able to save or update the record.
Please help
MrFitz
I have This..
My form looks like this
My db table looks like this
Here is my debug at the submit button...
The problem is that it creates a record in the db table with a 0 in the "user_id_link" and NO OTHER INFO, and that ONLY occurs if I use this.
If I say NO to the "Load under model id" then it does not even do that.
I have tried the DB save with either the "Save under model ID" as Yes and No, also I have tried the model Id as just "profile" as well as I have it now and nothing makes it save the record successfully.
I just want it to be able to save or update the record.
Please help
MrFitz
Hi The Fitz,
Does the table have a Primary Key?
What settings are in the DB Save action?
Bob
Does the table have a Primary Key?
What settings are in the DB Save action?
Bob
Hi The Fitz,
Does the table have a Primary Key?
yes, its user_id_link
What settings are in the DB Save action?
Bob
Hey Bob,
Ok,
I've put more than 20 hours into getting this simple form to save.
I turned on site debugging and it seems that because I am providing the user_id_link (which is the user's id) to link the records together, that the database query is getting submitted as an UPDATE and NOT an INSERT. Even though there is no record in existence. How do I tell the wizard that its an INSERT if it does not find the record, and its an UPDATE if it did find the record?
The database uses the user_id_link as its primary key (not an auto-inc key).
Thanks
MrFitz
Ok,
I've put more than 20 hours into getting this simple form to save.
I turned on site debugging and it seems that because I am providing the user_id_link (which is the user's id) to link the records together, that the database query is getting submitted as an UPDATE and NOT an INSERT. Even though there is no record in existence. How do I tell the wizard that its an INSERT if it does not find the record, and its an UPDATE if it did find the record?
The database uses the user_id_link as its primary key (not an auto-inc key).
Thanks
MrFitz
Hi The Fitz,
The Joomla Database code that ChronoForms uses is very simple. Check the Primary Key value in the new record, if there is no value set, or the value doesn't exist then INSERT, if the value does exist then UPDATE.
The Model IDs you are using (if you need them) should be just profile - I don't know what will happen with $form->data[profile]
Bob
The Joomla Database code that ChronoForms uses is very simple. Check the Primary Key value in the new record, if there is no value set, or the value doesn't exist then INSERT, if the value does exist then UPDATE.
The Model IDs you are using (if you need them) should be just profile - I don't know what will happen with $form->data[profile]
Bob
Hi Bob,
Seems simple, but because the data coming into my form was the user's id, I had declared its value as user_id_link, which meant that the data for the primary key in the table and its field name are always populated whether the record existed in the dbase or not.
So I added an auto_id field and made it primary key, but locate the record using the user_id_link field, and NOW the form acts as it should.
Thanks for your attention!!
Mr Fitz😀
Seems simple, but because the data coming into my form was the user's id, I had declared its value as user_id_link, which meant that the data for the primary key in the table and its field name are always populated whether the record existed in the dbase or not.
So I added an auto_id field and made it primary key, but locate the record using the user_id_link field, and NOW the form acts as it should.
Thanks for your attention!!
Mr Fitz😀
This topic is locked and no more replies can be posted.