I wonder if this is possible and how it should be done.
I have the following form in a page:
<cfoutput>
<form action="" method="post">
<select name="cativity" size="4" multiple="multiple">
<option value="0" selected="selected">Select</option>
<cfloop query="getActivities">
<option value="#activity_id#, #activity_eng#">#activity_eng#</option>
</cfloop>
</select>
<input name="submit_button" type="submit" value="submit" />
</form>
</cfoutput>
As you can see does the option value hold both the activity_id and the activity_name. That is because I need both values but in different tables. The activity_id should go in to a relational table. When there would be only the activity_id value I could use a loop to do add the values to that relational table:
<cfloop index="ListElement" list="#Form.activity#" delimiters=",">
<cfquery name="insertAmenities" datasource="#Application.dsn#">
INSERT INTO company_activities
( company_id, activity_id )
VALUES
(
<cfqueryparam cfsqltype = "cf_sql_integer" value = "#Val( session.company )#" >
,<cfqueryparam cfsqltype="cf_sql_integer" value="#Val( ListElement )#"/>
)
</cfquery>
</cfloop>
But I need the string values from the selected activities as well as stated.
Those selected values should go as a comma delimited list in a varchar field the companies table.
To come back to the question. Is it possible to separate these values somehow, Or do I need javascript to do this?
Thanks in advance