Hi everyone,
BNDragon helped me last week to create a form which enable a registred user to insert, save and update data. My project was to create some checklists which each registred user can use, but with the limitation that a user can only create one record per form.
You will find attached to this topic a PDF file called CHRONOFORM FORM which explain precisely how BNDragon solved the issues I had.
You will also find a backup of this form, which you can use. But don't forget to adapt it and to create your database.
I hope it helps !
Cheers,
Marc
Thanks to BNDragon !
Thank you!🙂
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Hi, and thank you for such a great and detailed guide🙂 I have a question though from trying to adapt it to fit my own form. Not sure if I should start a new thread or post here, but here it goes.
I'm at the "custom code action" (on found) under the DB Read /On Load. The last few lines of php code seem to deal with reading data from the checkbox entries, but since I'm no php programmer I'm really struggling to adapt this to my case where I have two text boxes instead of checkboxes that I would want to read/save data from.
Hi Gjertsen,
What are the lines of code you need help with ?
Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Hi Gjertsen,
No, those lines just split the checkboxes values since they are normally a list of values, so if you don't have checkboxes in your form then this is not helpful!
Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
I'm sorry to ask again, but I can't seem to get this working. Am I wrong thinking that the custom code (which the above code was a part of) under On load/DB Read/On found handles the displaying of the found DB entries in the website form? If thats the case then my question is how can I insert my two textbox values in the website form instead of the checkbox ones in the example? Simply changing the checkbox1 and checkbox2 values don't seem to work. Since the only mention in the code of the saved form values are in the code above, I assumed they had to do with the inserting of the read DB values into the website form.
Best regards
Your problem is in the "save" part or the update part ?
the save part should be straight forward, a "DB Save" will handle this.
The update part should be the same, but you will have to set the primary key value in the "data array" before the "db save", you can read the data using a "db read" action.
You should not have to worry about any fields values in this process.
Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Ok, so I've installed the backup form that goes with the PDF guide and I got it to work with the checkboxes, just to try it as it is before trying to make it fit my own purpose.
To the example form I've then added a "text13" textbox to the designer and made a new table which includes this field as well. The form updates the DB just fine, but the strange ting is that the saved value to text13 remains visible in the textbox when changing users and even with no users logged in. The checkboxes changes values as they should.
The other strange thing is that the form only seem to save a record for the first user that submits the form. Any other users logging in doesn't get its own DB entry from submitting the form. Is there anything I've missed, and mabye even a connection between the two?
I'm at the point now where I've done some reading and understand that the update/save to DB for different users have to do with the primary key setting when creating the table (like you correctly mentioned in your last post), but I can't figure out which column that should be set as primary key. By default when creating a table a INT "id" column with extra set to "auto_increment" is suggested. I've tried removing the "auto_increment" setting, since I believe that the "id" column should contain the user id, and not an auto incremented number, but this doesn't seem to help. I've also tried setting "user_id" as primary key.
The table's primary key should be id and it should be set to auto increment, there is already another column created by default named "user_id", and that one will hold the user's id (if a user is logged in), this also happens automatically if you have the latest v5 update.
Please try creating a new fresh form with a new table and test this, each submission should then store a new record.
Let me know!
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Well, if you have the code above in the "update conditions" then the logged in user's record will always be updated, so, if you are submitting the form without being logged in then you will have a record with user_id = 0, and that record will be always updated.
Please try to login using 2 different users and submit the form each time, do you get 1 record or 2 records ?
Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.