I was wondering if someone can tell me how to approach this. I have some code that runs through all available entries within a channel and determine if its a match to the pre-determined variable. I can output the matches fine but I want to display a standard form if there is no match.
Here is my code so far
{exp:channel:entries channel="dynamic_activity" dynamic="no" author_id="CURRENT_USER"}
{exp:switchee variable = "{related_activity_id}/{related_adventure_id}" parse="inward"}
{case value="{embed:related_activity_id}/{embed:related_adventure_id}"}
{exp:safecracker
channel="dynamic_activity"
return="/admin/story/"
use_live_url="no"
error_handling=“inline”
preserve_checkboxes=“yes”
include_jquery="no"
author_id="CURRENT_USER"
entry_id="{entry_id}"
}
<input type="text" name="title" id="title" value="{title}">
<input type="text" name="related_adventure_id" id="related_adventure_id" value="{related_adventure_id}">
<input type="text" name="related_activity_id" id="related_activity_id" value="{related_activity_id}">
<input type="text" name="childs_name" id="childs_name" value="{childs_name}">
<input type="submit" name="submit" value="Update" class="button small red">
{/exp:safecracker}
{/case}
{/exp:switchee}
{/exp:channel:entries}
Here is the form that I want to display if no matches are found.
{exp:safecracker
channel="dynamic_activity"
return="/admin/story/"
use_live_url="no"
error_handling=“inline”
preserve_checkboxes=“yes”
include_jquery="no"
author_id="CURRENT_USER"
author_only="yes"
}
<input type="text" name="title" id="title" value="Dynamic Content for {embed:related_activity_id}">
<input type="text" name="related_adventure_id" id="related_adventure_id" value="{embed:related_adventure_id}">
<input type="text" name="related_activity_id" id="related_activity_id" value="{embed:related_activity_id}">
<input type="text" name="childs_name" id="childs_name" value="Enter the Childs Name">
<input type="submit" name="submit" value="Submit" class="button small red">
{/exp:safecracker}
If I use limit="1" then it only displays the first entry if I check if there is no content that matches then I load the form multiple times for each non matched entry. Any ideas/Help is appreciated.
Thanks
UPDATED: I have also tried this ...
{exp:switchee variable = "{related_activity_id}/{related_adventure_id}" parse="inward"}
{case value="{embed:related_activity_id}/{embed:related_adventure_id}"}
{exp:safecracker
channel="dynamic_activity"
return="/admin/story/"
use_live_url="no"
error_handling=“inline”
preserve_checkboxes=“yes”
include_jquery="no"
author_id="CURRENT_USER"
entry_id="{entry_id}"
}
<input type="text" name="title" id="title" value="{title}">
<input type="text" name="related_adventure_id" id="related_adventure_id" value="{related_adventure_id}">
<input type="text" name="related_activity_id" id="related_activity_id" value="{related_activity_id}">
<input type="text" name="childs_name" id="childs_name" value="{childs_name}">
<input type="submit" name="submit" value="Update" class="button small red">
{/exp:safecracker}
{/case}
{case default="Yes"}
{exp:safecracker
channel="dynamic_activity"
return="/admin/story/"
use_live_url="no"
error_handling=“inline”
preserve_checkboxes=“yes”
include_jquery="no"
author_id="CURRENT_USER"
author_only="yes"
}
<input type="text" name="title" id="title" value="Dynamic Content for {embed:related_activity_id}">
<input type="text" name="related_adventure_id" id="related_adventure_id" value="{embed:related_adventure_id}">
<input type="text" name="related_activity_id" id="related_activity_id" value="{embed:related_activity_id}">
<input type="text" name="childs_name" id="childs_name" value="Enter the Childs Name">
<input type="submit" name="submit" value="Submit" class="button small red">
{/exp:safecracker}
{/case}
{/exp:switchee}