Setting Form Values with CurrentSourceRow data

I am trying to pre-fill form data for the user based on data selected from a table's current row data.

I have a table (table32) with a Row Action button that I would like to use to fill a form's (form11) data. I've tried using the control component on click Set data as well as running a script to update the fields but can't seem to get it to work.

I am able to pull the data with {{currentSourceRow.Channel}} and {{currentSourceRow.Date}} but can't seem to get them to populate into form11's "Channel" (select9) and "Reference Date" (date7) fields.

Any suggestions would be much appreciated.

Hey @Justin_Fuqua ,
Can you share screenshot to understand your problem more easily.

Hi @ZeroCodez .

Thank you for the response and yes absolutetly.

Here's the source table along with the Row Action and potential Click Handler

and here is the form I'm trying to populate based on data from the source table

also, here's a snippet of the data being pulled using currentSourceRow. I just don't know how to get these values over to the form.

Thank you for sharing scrrenshots @Justin_Fuqua

I understand your problem, I give you steps by which you easily updated the seletced row data of table:

  • Add component of Modal frame then it show when edit action button click on selected row like this
    image

  • Then in modal , add form component, and in form component generate fields or add fields by own but make sure that every form data key will be match to your database field
    image

  • To set data in form , then in data source of form write {{table.selectedRow}}
    image

Then , your data will set automatically.
If you have more questions then feel free to message me.

Thank you @ZeroCodez .

This method will work, but unfortunately, I'm wanting to use this action on many different tables so I would have to create a modalFrame for each table I'm using. Do you have any ideas for an alternative method where I would not have to create a modalFrame?

I ended up going with this script below and then adjusted table number depending on the row action the table was applied to.

// Ensure that the selectedRow data exists
if (table11.selectedRow) {
let selectedRowData = table11.selectedRow;

// Update form11 fields with the selected row data
form11.setData({
    "Reference Date": selectedRowData['Date'] || "",  // Assuming 'Date' is the key in selectedRow
    "Channel": selectedRowData['Channel'] || "",      // Assuming 'Channel' is the key in selectedRow
    "Insight Type": "Insight"                         // Set this field explicitly to "Insight"
    // Add other fields as needed
});

} else {
console.error("No selected row data available or row is not selected.");
}