Copy link to clipboard
Copied
I'm displaying data in two different tables. All of the data is static except for a status field which is also the field that determines what table the data is displayed in. Inside of form tags I am using a cfoutput tag to loop through the records for each table. The status record is in a cfinput with a type of radio button to set the status. I can submit the form using the onClick event of the radio button but I'm unsure how to pass the record id of the record that will need the status field to be updated on my action page. Is it possible to pass this record id along using javascript and then read that it on the action page to pass along to my sql? I planned to send the form back to the same page so that toggling the radio button would move the record to the other table. I wanted to avoid using a submit button and have the change in values of the status field move the record to the "closed" status table or vice versa.
Greetings,
Have you tried adding the code below the end of your action line
?record_id=#URLEncodedFormat(record_id)#
Example:
onClick="this.form.action='path_to_page.cfm?record_id=#URLEncodedFormat(record_id)#';this.form.submit()"
If I understand what it is you are trying to do, I setup a sample and tried the above "Example" code and it
passed a record id to the designated page without any issues arising.
Leonard
Copy link to clipboard
Copied
Greetings,
Have you tried adding the code below the end of your action line
?record_id=#URLEncodedFormat(record_id)#
Example:
onClick="this.form.action='path_to_page.cfm?record_id=#URLEncodedFormat(record_id)#';this.form.submit()"
If I understand what it is you are trying to do, I setup a sample and tried the above "Example" code and it
passed a record id to the designated page without any issues arising.
Leonard
Copy link to clipboard
Copied
Hi Lenorad,
I ended up building my forms a different way in this situation but your answer was exactly what I was looking for at the time. I was unaware that I could pass the action url with a variable on it as part of the onClick event. Thanks for showing me this.
-John