Created
November 14, 2011 15:12
-
-
Save rsanchez/1364133 to your computer and use it in GitHub Desktop.
Revisions
-
rsanchez revised this gist
Apr 19, 2012 . 1 changed file with 2 additions and 11 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,14 +14,5 @@ {/exp:safecracker} {!-- add this code if you are using Matrix (w/ PHP on Input) --} <?php $_GET['clone'] = 'y' ?> -
rsanchez revised this gist
Apr 19, 2012 . 1 changed file with 13 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -12,4 +12,16 @@ <input type="hidden" name="entry_id" value=""> {/exp:safecracker} {!-- add this code if you are using Matrix --} <script type="text/javascript"> $("table.matrix tbody tr :input").each(function() { var i = $(this).parents("tr").index(); if (this.name.match(/row_order/) && this.value.match(/^row_id_\d+$/)) { this.value = "row_new_"+i; } else { this.name = this.name.replace(/row_id_\d+/g, "row_new_"+i); } }); </script> -
rsanchez revised this gist
Apr 19, 2012 . 1 changed file with 0 additions and 13 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,13 +0,0 @@ -
rsanchez revised this gist
Apr 19, 2012 . 1 changed file with 13 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ /** * if you have a matrix, you'll need to add this after your form */ <script type="text/javascript"> $("table.matrix tbody tr :input").each(function() { var i = $(this).parents("tr").index(); if (this.name.match(/row_order/) && this.value.match(/^row_id_\d+$/)) { this.value = "row_new_"+i; } else { this.name = this.name.replace(/row_id_\d+/g, "row_new_"+i); } }); </script> -
rsanchez revised this gist
Nov 14, 2011 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ {!--example url: template_group/template/123--} {exp:safecracker entry_id="{segment_3}" return="template_group/template/ENTRY_ID"} ... -
rsanchez created this gist
Nov 14, 2011 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ {!--example url: template_group/template/123--} {exp:safecracker entry_id="123" return="template_group/template/ENTRY_ID"} ... {!-- this is the trick that duplicates the entry even though entry_id 123 is LOADED into this form this blank entry_id field will trick SC into thinking this is a new entry --} <input type="hidden" name="entry_id" value=""> {/exp:safecracker}