Help! I need to be able to edit a record in a database. I followed the tutorial in the FAQ posted by GreyHead on 25 Feb 2013, but still have a question. Is there custom PHP that explains how to show an edit button after the record has been retrieved, that would allow the user to edit and then saves the edited record?
Hi cmichae1,
It really does depend on where and how you want them to edit the data. Normally I'd add either a link or a mini-form (with just a submit button) that links to the edit form. If they are logged in users you can recover their data using a DB Record Loader tied to their user id.
Bob
It really does depend on where and how you want them to edit the data. Normally I'd add either a link or a mini-form (with just a submit button) that links to the edit form. If they are logged in users you can recover their data using a DB Record Loader tied to their user id.
Bob
Thanx Bill,
I like your idea of a link to the edit form. Do you have some code suggestions on how to pass the current data view form to the edit form?
Caroline
I like your idea of a link to the edit form. Do you have some code suggestions on how to pass the current data view form to the edit form?
Caroline
Hi Caroline,
Not without a bit more context. If the user is logged in then the User ID is typically the most useful identifier. If they are not then adding something either to the link or the User session will probably work.
Bob
Not without a bit more context. If the user is logged in then the User ID is typically the most useful identifier. If they are not then adding something either to the link or the User session will probably work.
Bob
The process would work as follows:
A user (with edit permission) would log in
then retrieve a record (based on some search criteria)
he sees that corrections are needed for 1 or more fields so he clicks an edit button (passing the current data view form to the edit form)
then edits the fields as needed
and then clicks a button to submit/save
A user (with edit permission) would log in
then retrieve a record (based on some search criteria)
he sees that corrections are needed for 1 or more fields so he clicks an edit button (passing the current data view form to the edit form)
then edits the fields as needed
and then clicks a button to submit/save
Hi Caroline,
It looks as though you could do this by tracking the record id through the process. Add it to the View form as a hidden input and then use the value to look up the saved record for editing. Keep it in the Edit form as a hidden input so that the same record is updates when the form is saved.
Bob
It looks as though you could do this by tracking the record id through the process. Add it to the View form as a hidden input and then use the value to look up the saved record for editing. Keep it in the Edit form as a hidden input so that the same record is updates when the form is saved.
Bob
Hi Bob,
I am sorta following your suggestion.
Can you provide an example? Maybe use one of the existing tutorials and extending it with an example of which chronoforms widget to use and the settings?
Thanx for your help!!!!
I am sorta following your suggestion.
Can you provide an example? Maybe use one of the existing tutorials and extending it with an example of which chronoforms widget to use and the settings?
Thanx for your help!!!!
Hi Bob,
I constructed the form using ChronoForms so cf_uid already exists, is cf_uid the same as record id? Why do I have to add it to the view form as hidden input? Doesn’t it already exist as part of the record? I read the tutorial regarding adding the user ID to a hidden field but it doesn’t seem to apply to what I am tying to do because of the built-in features of ChronoForms, i.e. the existence of cf_uid.
Assuming that I am wrong and I must pass the contents of cf_uid to some other field; I think I would do that by moving a Custom Element (HTML/PHP) to the Preview Tab; and in the code box type
<input type=’hidden’ name=’cf_uid’ value=’<?php echo $cf_uid; ?>’ />
but, I am pretty sure this is wrong because the php syntax is incorrect and I don’t think php is required to do this. And BTW, I am very new to php, SQL, Joomla, et al but not completely ignorant to programming.
I would happliy buy your book but I am using a later version of ChronoForms and don't know if it would help. Arghhh! Thanks for any help.
I constructed the form using ChronoForms so cf_uid already exists, is cf_uid the same as record id? Why do I have to add it to the view form as hidden input? Doesn’t it already exist as part of the record? I read the tutorial regarding adding the user ID to a hidden field but it doesn’t seem to apply to what I am tying to do because of the built-in features of ChronoForms, i.e. the existence of cf_uid.
Assuming that I am wrong and I must pass the contents of cf_uid to some other field; I think I would do that by moving a Custom Element (HTML/PHP) to the Preview Tab; and in the code box type
<input type=’hidden’ name=’cf_uid’ value=’<?php echo $cf_uid; ?>’ />
but, I am pretty sure this is wrong because the php syntax is incorrect and I don’t think php is required to do this. And BTW, I am very new to php, SQL, Joomla, et al but not completely ignorant to programming.
I would happliy buy your book but I am using a later version of ChronoForms and don't know if it would help. Arghhh! Thanks for any help.
Hi cmichae1,
No, if you look at the table data you'll see that the record id is cf_id; cf_uid is a random string that you can use a a unique id if you need one (though technically there is a very very small chance that it may not be unique).
Please see this FAQ about editing records.
Please see this FAQ about the book.
Bob
PS This should have all straight quotes
No, if you look at the table data you'll see that the record id is cf_id; cf_uid is a random string that you can use a a unique id if you need one (though technically there is a very very small chance that it may not be unique).
Please see this FAQ about editing records.
Please see this FAQ about the book.
Bob
PS This should have all straight quotes
<input type='hidden' name='cf_id' value='<?php echo $cf_id; ?>' />
This topic is locked and no more replies can be posted.