Forums

Displaying html table in custom code

tshirley 05 Sep, 2016
Hello,

I have a CF5 application that is interfacing with a Salesforce database using an API and CURL - all good, I can use the API to read and write single records, and read multiple records into arrays to populate dropdowns.

I would like to present a table from an array that I have read into form->data, and have the user select one row for editing, as can be done in Chronoconnectivity from a MySQL table. It appears that CC can only operate on MySQL databases, so my next thought is to use an HTML table in a Custom Code block to display the selection.

I can see that this would work using a for/each loop and I can also create a selection button in a column in the table.

So what is next? Can I use a button to trigger an action such as redirecting to an edit form with parameters to identify the record?

Is there any code that shows a basic example of this kind of functionality?

Cheers

Tim
GreyHead 05 Sep, 2016
Hi Tim,

Yes, you can add a button or a link to open a form event for editing (that's more or less what CC does). If you include the row ID in the link URL you can use that in a DB Read action in the form event to load the matching record:
<a href='index.php?option=com_chronoforms5&chronoform=fomr_name&rid={record_id}&task=edit' >[ Edit ]</a>

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