I'm relatively new to Alpha5 web development, so I'm struggling with how to retrieve the value of a field in a 'Detail View' component control.

I would like to display a foreign key lookup value next to a field Text Box (client_id) using the Freeform template. I don't know how to get the current field value for the client_id field so that it can be used in the sql_lookup().

Here's what my freeform layout code looks like:

{client_id}
<%a5
? sql_lookup("::name::cciw_db","cciw.client","client_id = "+ <client_id_value> ,"last_name + ', ' + first_name")
%>

I have not been successful at figuring out how to retrieve the client_id value. I need to put it in place of <client_id_value> above.

Can anyone help? Thanks.