Auto-submit
Posted: 02 September 2010 09:37 PM   [ Ignore ]
Circled in the Yearbook
RankRankRank
Total Posts:  702
Joined  2010-04-08

So I call a page with a SafeCracker form on and in the url are several segments that feed the form fields, the form auto submits and redirects to where ever.

As an example, let’s say I want to change the status of an entry to closed, which I do: The link to change the status could be http://www.site.com/templategroup/template/close, the template is called, the status field is changed to closed and the page redirects back to http://www.site.com/templategroup/template/done. The done segment fires a conditional to say the status has been changed.

What do you think?

Regards
Lee

[ Edited: 29 September 2010 09:20 PM by Rob Sanchez ]
Profile
 
 
Posted: 02 September 2010 09:54 PM   [ Ignore ]   [ # 1 ]
Teen Scream
Avatar
RankRankRank
Total Posts:  3541
Joined  2009-05-29

I think you can achieve this with some javascript.

window.onload = function() {
    document
.getElementById('publishForm').submit();
Profile
 
 
Posted: 08 September 2010 06:47 PM   [ Ignore ]   [ # 2 ]
Circled in the Yearbook
RankRankRank
Total Posts:  702
Joined  2010-04-08

Thank you.

Profile
 
 
Posted: 20 September 2010 09:04 PM   [ Ignore ]   [ # 3 ]
Teen Scream
Avatar
RankRankRank
Total Posts:  3541
Joined  2009-05-29

If you use that javascript it will redirect you to wherever you set in your return=”” param in your safecracker form.

You can achieve this without javascript. Just have a separate safecracker form for each status, and style your submit button like a link:

<h1>Set Status</h1>
{exp:safecracker entry_id="{segment_3}" status="waiting" return="site/whatever" safecracker_head="no"}
<input type="submit" value="WAITING" style="border:none;text-decoration:underline;cursor:pointer" />
{/exp:safecracker}
{exp
:safecracker entry_id="{segment_3}" status="service" return="site/whatever" safecracker_head="no"}
<input type="submit" value="SERVICE" style="border:none;text-decoration:underline;cursor:pointer" />
{/exp:safecracker}
{exp
:safecracker entry_id="{segment_3}" status="finished" return="site/whatever" safecracker_head="no"}
<input type="submit" value="FINISHED" style="border:none;text-decoration:underline;cursor:pointer" />
{/exp:safecracker} 
Profile
 
 
Posted: 20 September 2010 09:06 PM   [ Ignore ]   [ # 4 ]
Teen Scream
Avatar
RankRankRank
Total Posts:  3541
Joined  2009-05-29

I just thought of another way:

<h1>Set Status</h1>
{exp:safecracker entry_id="{segment_3}" return="site/whatever" safecracker_head="no"}
<input type="submit" name="status" value="finished" style="border:none;text-decoration:underline;cursor:pointer" />
<
input type="submit" name="status" value="service" style="border:none;text-decoration:underline;cursor:pointer" />
<
input type="submit" name="status" value="waiting" style="border:none;text-decoration:underline;cursor:pointer" />
{/exp:safecracker} 
Profile