Question

I want to append entry_id came from a selection box (embedded) to a safecracker URL

This is the code:

{exp:safecracker channel="blending_log"  return="sthome/blending/ENTRY_ID" dynamic_title="     [selected_tea]_[organic_or_conventional][date_time][agent_number]"}
<h3>Select and enter data</h3>
{embed="stembeds/.blending_select_tea"}

{!--------Receive data to create value--------}
<input type="hidden" name="title" value="" />
<br /><br />
Organic Or Conventional:
 {field:org_con}

 Agent Number:
 {field:agent_number}

{!-----END Receive data to create lot number-------} 

This is the embed:

<select name="selected_tea">
<option selected="selected" >Select a Tea</option>
{exp:channel:entries channel="tea_herbs" order_by="title" sort="asc"}

<option name={title} id={entry_id} value={url_title}>{title}</option>

{/exp:channel:entries} 

</select>

In embed line 4 I have id="{entry_id}

<option name={title} id={entry_id} value={url_title}>{title}</option>

I want to take entry id and append it to safecracker's URL like below:

{exp:safecracker channel="blending_log"  return="sthome/blending/ENTRY_ID/entry_id" dynamic_title="     [selected_tea]_[organic_or_conventional][date_time][agent_number]"}

Because I want to use entry_id in next page to retrieve some data in tea_herbs channel using {last_segment}

Is this possible ?

I read documents for safecracker and I tried entry_id = "{segment_....}" but it did not work. May be I am using entry_id = "{segment_....}" wrong way.

Please help me to accomplish this task

Was it helpful?

Solution

In your SafeCracker tag, ENTRY_ID will be replaced with the actual entry ID of the new entry. So just use return="sthome/blending/ENTRY_ID. This will redirect you to sthome/blending/45 (for example).

Then, use entry_id="{segment_3}" in your sthome/blending template - though if you're using a standard Channel Entries or Safecracker tag on that page, it should read the entry ID automatically (since its the third segment).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top