Create an EDIT link

lselbach 08 Nov, 2013
Hi there!

I´ve created a form with ChronoForms to put data in a database.

Then I´ve used another extension (ArtData) to retrieve data and list from the same database. Check a screen capture:
[attachment=0]chrono-connectivity-link.jpg[/attachment]

Now I want to EDIT a single record using the same created form, in the FRONTEND.

I just need
1. how to make that form available for editing
2. How to get the specific record from Database and show the fields filling the form, so the user can edit it and save.
3. After clicking the submit button, it should link to that article with other extension.

If you want back end access, please let me know.

Thanks in advance.

Lucas Selbach
GreyHead 08 Nov, 2013
Hi Iselbach,

You can load data into a form for editing using the DB Record Loader action in the On Load event of the form. To get this to work you need to pass the primary key value of the record. I don't know how you'd do this from ArtData.

Bob
lselbach 08 Nov, 2013
Hi Bob,

Thanks for fast replying.

ArtData support helped me creating custom parameters called "deleteURL" and "editURL" so I define a link and put inside the parameter and it reflects on the button.

Just for a sample, here follows the 'deleteURL' code
deleteUrl="index.php?option=com_content&view=article&id=17" sLengthMenu="Mostrar _MENU_ registros" oLanguage_sInfo="Mostrando _START_ a _END_ de _TOTAL_ registros"


It makes an SQL command to delete the record based on the field 'numero' (which means number in portuguese) and opens another article that shows 'register ### deleted'

The link for EDITING 'editURL' should be something like that, carrying a parameter of the current record to open the edit form for editing that record.

If you give me actions needed on the backend and the link syntax, I send this to ArtData support and they finish.

Thanks
Lucas
GreyHead 08 Nov, 2013
Hi Lucas,

It would just be a normal link to the form including the record id e.g. &token=999

Bob
lselbach 08 Nov, 2013
That´s perfect, Bob.

Just let me know which field ?token=## can be used.

For example, I´m using a field called 'numero', because the form is numbered.

Or if token is the cf_id field.

Regards
Lucas
lselbach 08 Nov, 2013
Bob, it´s all in here, correct??

Tutorial Chronoforms V4 "How to load one row from a DB table into your form"
lselbach 08 Nov, 2013
So I followed your tutorial, it loads the correct record.

I just have two questions:

12. Some may ask, what if I clicked submit button now ? What would happen ?
Indeed, a new db record will be created, but of course many would like to update the loaded record,in this case, you will have to go back to the wizard edit and drag a “Hidden field” to your form and edit its name to “cf_id” which is the “Primary Key” of the connected table, only then the loaded record will be updated when the form is submitted instead of creating a new one.



Ok, but will this affect a new record registration? Or the hidden field will be filled with a new number??

13. One final note is that you should be able to grab the data loaded through multiple methods, like {field_name} in your form code, so for example, if you have this text in your form code:
{cf_uid} or {profession}
then it would be replaced by the value of the same field from the record loaded.



I didn´t figured out what this means. But I think I wouldn´t need to use it, as I´m only using the 'numero' field to open a specific record.

Regards
Lucas
This topic is locked and no more replies can be posted.